Skip to content

Commit 4d4e242

Browse files
committed
Umbraco installer - final transforms for ImageProcessor
1 parent a402375 commit 4d4e242

File tree

6 files changed

+45
-7
lines changed

6 files changed

+45
-7
lines changed

build/UmbracoFileSystemProviders.Azure.proj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@
137137
<UmbracoInstallerLogo Include="$(MSBuildProjectDirectory)\assets\logo\azure-logo-32.png"/>
138138
<PackageFile Include="$(MSBuildProjectDirectory)\package.xml" />
139139
<ImageProcessorSecurityConfigXDTInstallFile Include="$(MSBuildProjectDirectory)\transforms\security.config.install.xdt" />
140-
<ImageProcessorSecurityConfigDefaultFile Include="$(InstallerProjectDir)\config\imageprocessor\security.config" />
140+
<ImageProcessorSecurityConfigDefaultFile Include="$(InstallerProjectDir)\config\imageprocessor\security.config" />
141+
<ImageProcessorWebConfigXDTInstallFile Include="$(MSBuildProjectDirectory)\transforms\imageprocessor.web.config.install.xdt" />
141142

142143
<!-- NuGet specific -->
143144
<SrcFiles Include="$(ProjectDir)\**\*.cs" Exclude="$(ProjectDir)\obj\**"/>
@@ -153,6 +154,7 @@
153154
<Copy SourceFiles="@(FileSystemProvidersConfigXDTUninstallFile)" DestinationFolder="$(BuildUmbDir)\App_Plugins\UmbracoFileSystemProviders\Azure\Install" />
154155
<Copy SourceFiles="@(ImageProcessorSecurityConfigXDTInstallFile)" DestinationFolder="$(BuildUmbDir)\App_Plugins\UmbracoFileSystemProviders\Azure\Install" />
155156
<Copy SourceFiles="@(ImageProcessorSecurityConfigDefaultFile)" DestinationFolder="$(BuildUmbDir)\App_Plugins\UmbracoFileSystemProviders\Azure\Install" />
157+
<Copy SourceFiles="@(ImageProcessorWebConfigXDTInstallFile)" DestinationFolder="$(BuildUmbDir)\App_Plugins\UmbracoFileSystemProviders\Azure\Install" />
156158

157159
<Copy SourceFiles="@(UmbracoInstallerFiles)" DestinationFiles="@(UmbracoInstallerFiles->'$(BuildUmbDir)\App_Plugins\UmbracoFileSystemProviders\Azure\Install\Configurator\%(RecursiveDir)%(Filename)%(Extension)')" />
158160
<Copy SourceFiles="@(UmbracoInstallerLogo)" DestinationFolder="$(BuildUmbDir)\App_Plugins\UmbracoFileSystemProviders\Azure\Install" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
3+
<configSections>
4+
<sectionGroup name="imageProcessor" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing">
5+
<section name="security" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageSecuritySection, ImageProcessor.Web" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing"/>
6+
</sectionGroup>
7+
</configSections>
8+
9+
<imageProcessor xdt:Transform="InsertIfMissing">
10+
<security configSource="config\imageprocessor\security.config" xdt:Transform="InsertIfMissing" />
11+
</imageProcessor>
12+
</configuration>

src/UmbracoFileSystemProviders.Azure.Installer/Configurator/Views/Configure.ascx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@
5959

6060
<div class="row">
6161
<div<%=span %>>
62-
<div class="alert alert-success" ng-show="saved && (status === 'Ok' || status === 'ImageProcessorWebCompatibility')">
62+
<div class="alert alert-success" ng-show="saved && (status === 'Ok' || status === 'ImageProcessorWebCompatibility' || status === 'ImageProcessorWebConfigError')">
6363
The Azure storage provider was sucessfully configured and your media is now as light as candyfloss
6464
</div>
6565
<div class="alert alert-info" ng-show="saved && status === 'ImageProcessorWebCompatibility'">
66-
<strong>Warning!</strong> You need to upgrade the installed version of ImageProcessor.Web to v4.3.2+ to be fully compatible with this package <a href="https://our.umbraco.org/projects/collaboration/imageprocessor/" target="_blank">https://our.umbraco.org/projects/collaboration/imageprocessor/</a>
66+
<strong>Warning!</strong> You need to upgrade the installed version of ImageProcessor.Web to v4.3.2+ (reinstall this package once you've updated) to be fully compatible with this package <a href="https://our.umbraco.org/projects/collaboration/imageprocessor/" target="_blank">https://our.umbraco.org/projects/collaboration/imageprocessor/</a>
67+
</div>
68+
<div class="alert alert-info" ng-show="saved && status === 'ImageProcessorWebConfigError'">
69+
<strong>Warning!</strong> The installer was unable to configure ImageProcessor.Web, please see documentation to fix the issue <a href="https://our.umbraco.org/projects/collaboration/umbracofilesystemprovidersazure/" target="_blank">https://our.umbraco.org/projects/collaboration/umbracofilesystemprovidersazure/</a>
6770
</div>
6871
<div class="alert alert-error" ng-show="saved && status != 'Ok' && status != 'ImageProcessorWebCompatibility'">
6972
<strong>Oh no</strong>, something went wrong saving, please check Umbraco log files for exceptions

src/UmbracoFileSystemProviders.Azure.Installer/Enums/InstallerStatus.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public enum InstallerStatus
1616
SaveXdtError,
1717
SaveConfigError,
1818
ConnectionError,
19-
ImageProcessorWebCompatibility
19+
ImageProcessorWebCompatibility,
20+
ImageProcessorWebConfigError
2021
}
2122
}

src/UmbracoFileSystemProviders.Azure.Installer/InstallerController.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,21 @@ public InstallerStatus PostParameters(IEnumerable<Parameter> parameters)
8585
}
8686
else
8787
{
88-
// merge in Storage url
88+
// merge in storage url to ImageProcessor security.config xdt
8989
SaveBlobPathToImageProcessorSecurityXdt(ImageProcessorSecurityInstallXdtPath, host);
9090

9191
// transform ImageProcessor security.config
92-
ExecuteImageProcessorSecurityConfigTransform();
92+
if (ExecuteImageProcessorSecurityConfigTransform())
93+
{
94+
if (!ExecuteImageProcessorWebConfigTransform())
95+
{
96+
return InstallerStatus.ImageProcessorWebConfigError;
97+
}
98+
}
99+
else
100+
{
101+
return InstallerStatus.ImageProcessorWebConfigError;
102+
}
93103
}
94104

95105
return InstallerStatus.Ok;
@@ -271,7 +281,16 @@ private static bool ExecuteImageProcessorSecurityConfigTransform()
271281
File.Copy(ImageProcessorSecurityDefaultConfigPath, ImageProcessorSecurityConfigPath);
272282
}
273283

274-
var transFormConfigAction = helper.parseStringToXmlNode("<Action runat=\"install\" undo=\"true\" alias=\"UmbracoFileSystemProviders.Azure.TransformConfig\" file=\"~/config/imageprocessor/security.config\" xdtfile=\"~/app_plugins/UmbracoFileSystemProviders/Azure/install/security.config\">" +
284+
var transFormConfigAction = helper.parseStringToXmlNode("<Action runat=\"install\" undo=\"false\" alias=\"UmbracoFileSystemProviders.Azure.TransformConfig\" file=\"~/config/imageprocessor/security.config\" xdtfile=\"~/app_plugins/UmbracoFileSystemProviders/Azure/install/security.config\">" +
285+
"</Action>").FirstChild;
286+
287+
var transformConfig = new PackageActions.TransformConfig();
288+
return transformConfig.Execute("UmbracoFileSystemProviders.Azure", transFormConfigAction);
289+
}
290+
291+
private static bool ExecuteImageProcessorWebConfigTransform()
292+
{
293+
var transFormConfigAction = helper.parseStringToXmlNode("<Action runat=\"install\" undo=\"false\" alias=\"UmbracoFileSystemProviders.Azure.TransformConfig\" file=\"~/web.config\" xdtfile=\"~/app_plugins/UmbracoFileSystemProviders/Azure/install/imageprocessor.web.config\">" +
275294
"</Action>").FirstChild;
276295

277296
var transformConfig = new PackageActions.TransformConfig();

src/UmbracoFileSystemProviders.Azure.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildPackage", "BuildPackag
1717
..\appveyor.yml = ..\appveyor.yml
1818
..\build\transforms\FileSystemProviders.config.install.xdt = ..\build\transforms\FileSystemProviders.config.install.xdt
1919
..\build\transforms\FileSystemProviders.config.uninstall.xdt = ..\build\transforms\FileSystemProviders.config.uninstall.xdt
20+
..\build\transforms\imageprocessor.web.config.install.xdt = ..\build\transforms\imageprocessor.web.config.install.xdt
2021
..\build\package.nuspec = ..\build\package.nuspec
2122
..\build\package.proj = ..\build\package.proj
2223
..\build\package.xml = ..\build\package.xml

0 commit comments

Comments
 (0)