Skip to content

Commit 5928a41

Browse files
committed
chore: updated to Umbraco v8.0.1 release packages and refactor code to build and all tests pass
1 parent 65448c6 commit 5928a41

File tree

16 files changed

+783
-245
lines changed

16 files changed

+783
-245
lines changed

build/UmbracoFileSystemProviders.Azure.proj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<!-- SHARED PROPERTIES -->
1818
<PropertyGroup>
1919
<PackageName>UmbracoFileSystemProviders.Azure</PackageName>
20-
<MinUmbracoVersion>8.0.0-alpha.58.1580</MinUmbracoVersion>
20+
<MinUmbracoVersion>8.0.1</MinUmbracoVersion>
2121
<Readme>An Azure Blob Storage IFileSystem provider for Umbraco.</Readme>
2222
<AuthorName>James Jackson-South, Dirk Seefeld, Lars-Erik Aabech, Jeavon Leopold</AuthorName>
2323
<AuthorUrl>https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure/graphs/contributors</AuthorUrl>
@@ -213,7 +213,6 @@
213213
Description="$(Description)"
214214
Summary="$(Readme)"
215215
Version="$(ProductVersion)"
216-
MinimumRequiredUmbracoVersion ="$(MinUmbracoVersion)"
217216
Authors="$(AuthorName)"
218217
Owners="$(Owners)"
219218
Copyright="$(Copyright)"

build/package.nuspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<language></language>
1717
<tags></tags>
1818
<dependencies>
19-
<dependency id="UmbracoCms.Core" version="0.0.0" />
19+
<dependency id="UmbracoCms.Core" version="8.0.1" />
20+
<dependency id="UmbracoCms.Web" version="8.0.1" />
2021
<dependency id="WindowsAzure.Storage" version="8.7.0" />
2122
<dependency id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" />
2223
<dependency id="Microsoft.Azure.KeyVault.Core" version="2.0.4" />

src/UmbracoFileSystemProviders.Azure.Installer/InstallerController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer
2020
using global::Umbraco.Core.Composing;
2121
using global::Umbraco.Core.Logging;
2222
using global::Umbraco.Core.Xml;
23-
using global::Umbraco.Web._Legacy.PackageActions;
2423
using global::Umbraco.Web.Mvc;
2524
using global::Umbraco.Web.WebApi;
2625
using Microsoft.WindowsAzure.Storage;
2726
using Microsoft.WindowsAzure.Storage.Blob;
2827
using Models;
28+
using System.Runtime.CompilerServices;
29+
using Our.Umbraco.FileSystemProviders.Azure.Helpers;
2930

3031
/// <summary>
3132
/// The installer controller for managing installer logic.
3233
/// </summary>
3334
[PluginController("FileSystemProviders")]
35+
3436
public class InstallerController : UmbracoAuthorizedApiController
3537
{
3638
private static readonly string ImageProcessorWebAssemblyPath = HostingEnvironment.MapPath(Constants.ImageProcessor.WebAssemblyPath);

src/UmbracoFileSystemProviders.Azure.Installer/PackageActions.cs

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
// Copyright (c) James Jackson-South, Jeavon Leopold, and contributors. All rights reserved.
33
// Licensed under the Apache License, Version 2.0.
44
// </copyright>
5+
56
namespace Our.Umbraco.FileSystemProviders.Azure.Installer
67
{
78
using System;
89
using System.Web;
910
using System.Xml;
10-
using global::Umbraco.Core._Legacy.PackageActions;
11+
using System.Xml.Linq;
12+
1113
using global::Umbraco.Core.Composing;
1214
using global::Umbraco.Core.Logging;
13-
using global::Umbraco.Web._Legacy.PackageActions;
15+
using global::Umbraco.Core.PackageActions;
16+
using global::Umbraco.Core;
17+
1418
using Microsoft.Web.XmlTransform;
1519

1620
/// <summary>
@@ -30,7 +34,7 @@ public string Alias()
3034
}
3135

3236
/// <inheritdoc/>
33-
public bool Execute(string packageName, XmlNode xmlData)
37+
public bool Execute(string packageName, XElement xmlData)
3438
{
3539
return this.Transform(packageName, xmlData);
3640
}
@@ -47,7 +51,7 @@ public XmlNode SampleXml()
4751
}
4852

4953
/// <inheritdoc/>
50-
public bool Undo(string packageName, XmlNode xmlData)
54+
public bool Undo(string packageName, XElement xmlData)
5155
{
5256
return this.Transform(packageName, xmlData, true);
5357
}
@@ -59,12 +63,12 @@ public bool Undo(string packageName, XmlNode xmlData)
5963
/// <param name="xmlData">The XML data</param>
6064
/// <param name="uninstall">Whether to uninstall.</param>
6165
/// <returns><c>true</c> if the transform is sucessful.</returns>
62-
private bool Transform(string packageName, XmlNode xmlData, bool uninstall = false)
66+
private bool Transform(string packageName, XElement xmlData, bool uninstall = false)
6367
{
6468
// The config file we want to modify
65-
if (xmlData.Attributes != null)
69+
if (xmlData.Attributes() != null)
6670
{
67-
string file = xmlData.Attributes.GetNamedItem("file").Value;
71+
var file = AttributeValue<string>(xmlData, "file");
6872

6973
string sourceDocFileName = VirtualPathUtility.ToAbsolute(file);
7074

@@ -74,8 +78,8 @@ private bool Transform(string packageName, XmlNode xmlData, bool uninstall = fal
7478
{
7579
fileEnd = $"un{fileEnd}";
7680
}
77-
78-
string xdtfile = $"{xmlData.Attributes.GetNamedItem("xdtfile").Value}.{fileEnd}";
81+
82+
string xdtfile = $"{AttributeValue<string>(xmlData, "xdtfile")}.{fileEnd}";
7983
string xdtFileName = VirtualPathUtility.ToAbsolute(xdtfile);
8084

8185
// The translation at-hand
@@ -108,6 +112,22 @@ private bool Transform(string packageName, XmlNode xmlData, bool uninstall = fal
108112

109113
return true;
110114
}
115+
116+
public static T AttributeValue<T>(XElement xml, string attributeName)
117+
{
118+
if (xml == null) throw new ArgumentNullException("xml");
119+
if (xml.HasAttributes == false) return default(T);
120+
121+
if (xml.Attribute(attributeName) == null)
122+
return default(T);
123+
124+
var val = xml.Attribute(attributeName).Value;
125+
var result = val.TryConvertTo<T>();
126+
if (result.Success)
127+
return result.Result;
128+
129+
return default(T);
130+
}
111131
}
112132
}
113133
}

0 commit comments

Comments
 (0)