Skip to content

Commit 4c7b8d2

Browse files
committed
Adding a check to the Umbraco installer for the version of ImageProcessor.Web and displaying a warning if a upgrade is required
1 parent f6f8132 commit 4c7b8d2

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@
4343
</div>
4444

4545
<div class="row">
46-
<div class="alert alert-success" ng-show="saved && status === 'Ok'">
46+
<div class="alert alert-success" ng-show="saved && (status === 'Ok' || status === 'ImageProcessorWebCompatibility')">
4747
The Azure storage provider was sucessfully configured and your media is now as light as candyfloss
4848
</div>
49-
<div class="alert alert-error" ng-show="saved && status != 'Ok'">
49+
<div class="alert alert-info" ng-show="saved && status === 'ImageProcessorWebCompatibility'">
50+
<strong>Warning!</strong> You need to upgrade the installed version of ImageProcessor.Web 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>
51+
</div>
52+
<div class="alert alert-error" ng-show="saved && status != 'Ok' && status != 'ImageProcessorWebCompatibility'">
5053
<strong>Oh no</strong>, something went wrong saving, please check Umbraco log files for exceptions
5154
</div>
5255
<div class="alert alert-error" ng-show="!saved && status === 'ConnectionError'">

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public enum InstallerStatus
1515
Ok,
1616
SaveXdtError,
1717
SaveConfigError,
18-
ConnectionError
18+
ConnectionError,
19+
ImageProcessorWebCompatibility
1920
}
2021
}

src/UmbracoFileSystemProviders.Azure.Installer/InstallerController.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer
1414
using System;
1515
using System.Collections.Generic;
1616
using System.Configuration;
17+
using System.Diagnostics;
1718
using System.Linq;
1819
using System.Web.Hosting;
1920
using System.Web.Http;
@@ -34,10 +35,12 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer
3435
public class InstallerController : UmbracoAuthorizedApiController
3536
{
3637
private const string ProviderType = "Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure";
38+
private static readonly string ImageProcessorWebAssemblyPath = HostingEnvironment.MapPath("~/bin/ImageProcessor.Web.dll");
39+
private static readonly Version ImageProcessorWebMinRequiredVersion = new Version("4.3.2.0");
40+
3741
private readonly string fileSystemProvidersConfigInstallXdtPath = HostingEnvironment.MapPath("~/App_Plugins/UmbracoFileSystemProviders/Azure/Install/FileSystemProviders.config.install.xdt");
3842
private readonly string fileSystemProvidersConfigPath = HostingEnvironment.MapPath("~/Config/FileSystemProviders.config");
3943

40-
4144
// /Umbraco/backoffice/FileSystemProviders/Installer/GetParameters
4245
public IEnumerable<Parameter> GetParameters()
4346
{
@@ -49,7 +52,7 @@ public IEnumerable<Parameter> GetParameters()
4952
public InstallerStatus PostParameters(IEnumerable<Parameter> parameters)
5053
{
5154
var connection = parameters.SingleOrDefault(k => k.Key == "connectionString").Value;
52-
var containerName = parameters.SingleOrDefault(k => k.Key == "containerName").Value;
55+
var containerName = parameters.SingleOrDefault(k => k.Key == "containerName").Value;
5356

5457
if (!TestAzureCredentials(connection, containerName))
5558
{
@@ -63,6 +66,11 @@ public InstallerStatus PostParameters(IEnumerable<Parameter> parameters)
6366
return InstallerStatus.SaveConfigError;
6467
}
6568

69+
if (!CheckImageProcessorWebCompatibleVersion(ImageProcessorWebMinRequiredVersion))
70+
{
71+
return InstallerStatus.ImageProcessorWebCompatibility;
72+
}
73+
6674
return InstallerStatus.Ok;
6775
}
6876

@@ -207,5 +215,14 @@ private static bool TestAzureCredentials(string connectionString, string contain
207215

208216
return true;
209217
}
218+
219+
private static bool CheckImageProcessorWebCompatibleVersion(Version imageProcessorWebMinRequiredVersion)
220+
{
221+
var fileVersionInfo = FileVersionInfo.GetVersionInfo(ImageProcessorWebAssemblyPath);
222+
223+
var currentImageProcessorWebVersionInfo = new Version(fileVersionInfo.ProductVersion);
224+
225+
return currentImageProcessorWebVersionInfo >= imageProcessorWebMinRequiredVersion;
226+
}
210227
}
211228
}

0 commit comments

Comments
 (0)