From 133d7c92cb4d8d76f34d5d200bf1ecd07ffdeb66 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 16 Oct 2014 16:01:25 +1000 Subject: [PATCH] If the legacy razor macro engine is executed, ensures that the folder and required web.config exist before execution. --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 3 - src/Umbraco.Web/Mvc/Strings.Designer.cs | 2 +- ...ureSystemPathsApplicationStartupHandler.cs | 3 +- .../RazorCore/RazorMacroEngine.cs | 13 ++ .../Resources/Strings.Designer.cs | 2 +- .../Resources/Strings.resx | 2 +- .../Resources}/Web.config | 114 +++++++++--------- .../umbraco.MacroEngines.csproj | 6 +- 8 files changed, 77 insertions(+), 68 deletions(-) rename src/{Umbraco.Web.UI/MacroScripts => umbraco.MacroEngines/Resources}/Web.config (97%) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 787d7c0b74..3ca249efd5 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -634,9 +634,6 @@ Dashboard.config Designer - - Designer - Designer diff --git a/src/Umbraco.Web/Mvc/Strings.Designer.cs b/src/Umbraco.Web/Mvc/Strings.Designer.cs index fb978890d0..02a44fbbd7 100644 --- a/src/Umbraco.Web/Mvc/Strings.Designer.cs +++ b/src/Umbraco.Web/Mvc/Strings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34003 +// Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs b/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs index f5949ff1c3..dc354be71d 100644 --- a/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs +++ b/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs @@ -19,8 +19,7 @@ namespace umbraco.presentation EnsurePathExists("~/App_Code"); EnsurePathExists("~/App_Data"); EnsurePathExists(SystemDirectories.AppPlugins); - EnsurePathExists(SystemDirectories.Css); - EnsurePathExists(SystemDirectories.MacroScripts); + EnsurePathExists(SystemDirectories.Css); EnsurePathExists(SystemDirectories.Masterpages); EnsurePathExists(SystemDirectories.Media); EnsurePathExists(SystemDirectories.Scripts); diff --git a/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs b/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs index 03c9d9e9b8..e3c7a22bd0 100644 --- a/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs +++ b/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs @@ -175,6 +175,19 @@ namespace umbraco.MacroEngines } public string Execute(MacroModel macro, INode currentPage) { + + //if this is executing, we need to ensure the folder exists and that the correct web.config exists on that folder too + var absolutePath = IOHelper.MapPath(SystemDirectories.MacroScripts); + if (!Directory.Exists(absolutePath)) + Directory.CreateDirectory(absolutePath); + if (!File.Exists(Path.Combine(absolutePath, "web.config"))) + { + using (var writer = File.CreateText(Path.Combine(absolutePath, "web.config"))) + { + writer.Write(Strings.WebConfig); + } + } + try { Success = true; diff --git a/src/umbraco.MacroEngines/Resources/Strings.Designer.cs b/src/umbraco.MacroEngines/Resources/Strings.Designer.cs index 553c0b9460..236db870a0 100644 --- a/src/umbraco.MacroEngines/Resources/Strings.Designer.cs +++ b/src/umbraco.MacroEngines/Resources/Strings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34003 +// Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/umbraco.MacroEngines/Resources/Strings.resx b/src/umbraco.MacroEngines/Resources/Strings.resx index e3244825c1..698928939b 100644 --- a/src/umbraco.MacroEngines/Resources/Strings.resx +++ b/src/umbraco.MacroEngines/Resources/Strings.resx @@ -119,6 +119,6 @@ - ..\..\umbraco.web.ui\macroscripts\web.config;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + web.config;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 \ No newline at end of file diff --git a/src/Umbraco.Web.UI/MacroScripts/Web.config b/src/umbraco.MacroEngines/Resources/Web.config similarity index 97% rename from src/Umbraco.Web.UI/MacroScripts/Web.config rename to src/umbraco.MacroEngines/Resources/Web.config index 1ef2936cd8..163957b32e 100644 --- a/src/Umbraco.Web.UI/MacroScripts/Web.config +++ b/src/umbraco.MacroEngines/Resources/Web.config @@ -1,57 +1,57 @@ - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj index d840056e4f..6651f0c2ee 100644 --- a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj +++ b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj @@ -215,11 +215,11 @@ - - Resources\Web.config - + + Designer +