From 27283754c0d5f709dcc33cde940fb927f4feaf8f Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 1 Feb 2017 16:48:09 +1100 Subject: [PATCH 01/12] Changes IndexFieldPolicies to be a StaticFieldCollection which is a keyed collection instead of using Linq and iterating to find the values in critical code --- .../Config/IndexSetExtensions.cs | 4 +- .../Config/LazyIndexCriteria.cs | 12 ++-- src/UmbracoExamine/StaticFieldCollection.cs | 23 +++++++ src/UmbracoExamine/UmbracoContentIndexer.cs | 60 +++++++++++-------- src/UmbracoExamine/UmbracoExamine.csproj | 1 + src/UmbracoExamine/UmbracoMemberIndexer.cs | 15 +++-- 6 files changed, 78 insertions(+), 37 deletions(-) create mode 100644 src/UmbracoExamine/StaticFieldCollection.cs diff --git a/src/UmbracoExamine/Config/IndexSetExtensions.cs b/src/UmbracoExamine/Config/IndexSetExtensions.cs index 1255f50a3c..f4bd2e24b2 100644 --- a/src/UmbracoExamine/Config/IndexSetExtensions.cs +++ b/src/UmbracoExamine/Config/IndexSetExtensions.cs @@ -14,7 +14,7 @@ namespace UmbracoExamine.Config public static class IndexSetExtensions { internal static IIndexCriteria ToIndexCriteria(this IndexSet set, IDataService svc, - IEnumerable indexFieldPolicies) + StaticFieldCollection indexFieldPolicies) { return new LazyIndexCriteria(set, svc, indexFieldPolicies); } @@ -29,7 +29,7 @@ namespace UmbracoExamine.Config /// public static IIndexCriteria ToIndexCriteria(this IndexSet set, IDataService svc) { - return set.ToIndexCriteria(svc, Enumerable.Empty()); + return set.ToIndexCriteria(svc, new StaticFieldCollection()); } } diff --git a/src/UmbracoExamine/Config/LazyIndexCriteria.cs b/src/UmbracoExamine/Config/LazyIndexCriteria.cs index 72ab3f31ba..ee58431930 100644 --- a/src/UmbracoExamine/Config/LazyIndexCriteria.cs +++ b/src/UmbracoExamine/Config/LazyIndexCriteria.cs @@ -12,7 +12,7 @@ namespace UmbracoExamine.Config public LazyIndexCriteria( IndexSet set, IDataService svc, - IEnumerable indexFieldPolicies) + StaticFieldCollection indexFieldPolicies) { if (set == null) throw new ArgumentNullException("set"); if (indexFieldPolicies == null) throw new ArgumentNullException("indexFieldPolicies"); @@ -35,8 +35,9 @@ namespace UmbracoExamine.Config foreach (var u in userProps) { var field = new IndexField() { Name = u }; - var policy = indexFieldPolicies.FirstOrDefault(x => x.Name == u); - if (policy != null) + + StaticField policy; + if (indexFieldPolicies.TryGetValue(u, out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; @@ -55,8 +56,9 @@ namespace UmbracoExamine.Config foreach (var s in sysProps) { var field = new IndexField() { Name = s }; - var policy = indexFieldPolicies.FirstOrDefault(x => x.Name == s); - if (policy != null) + + StaticField policy; + if (indexFieldPolicies.TryGetValue(s, out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; diff --git a/src/UmbracoExamine/StaticFieldCollection.cs b/src/UmbracoExamine/StaticFieldCollection.cs new file mode 100644 index 0000000000..2b54eb8043 --- /dev/null +++ b/src/UmbracoExamine/StaticFieldCollection.cs @@ -0,0 +1,23 @@ +using System.Collections.ObjectModel; + +namespace UmbracoExamine +{ + internal class StaticFieldCollection : KeyedCollection + { + protected override string GetKeyForItem(StaticField item) + { + return item.Name; + } + + /// + /// Implements TryGetValue using the underlying dictionary + /// + /// + /// + /// + public bool TryGetValue(string key, out StaticField field) + { + return Dictionary.TryGetValue(key, out field); + } + } +} \ No newline at end of file diff --git a/src/UmbracoExamine/UmbracoContentIndexer.cs b/src/UmbracoExamine/UmbracoContentIndexer.cs index 0f3779034c..37382d2647 100644 --- a/src/UmbracoExamine/UmbracoContentIndexer.cs +++ b/src/UmbracoExamine/UmbracoContentIndexer.cs @@ -196,27 +196,27 @@ namespace UmbracoExamine /// Alot of standard umbraco fields shouldn't be tokenized or even indexed, just stored into lucene /// for retreival after searching. /// - internal static readonly List IndexFieldPolicies - = new List + internal static readonly StaticFieldCollection IndexFieldPolicies + = new StaticFieldCollection { new StaticField("id", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), new StaticField("key", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "version", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "parentID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "level", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), - new StaticField( "writerID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "creatorID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "nodeType", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "template", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "sortOrder", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), - new StaticField( "createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), - new StaticField( "updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), - new StaticField( "nodeName", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "urlName", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "writerName", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "creatorName", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "nodeTypeAlias", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "path", FieldIndexTypes.NOT_ANALYZED, false, string.Empty) + new StaticField("version", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("parentID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("level", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), + new StaticField("writerID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("creatorID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("nodeType", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("template", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("sortOrder", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), + new StaticField("createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), + new StaticField("updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), + new StaticField("nodeName", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("urlName", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("writerName", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("creatorName", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("nodeTypeAlias", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("path", FieldIndexTypes.NOT_ANALYZED, false, string.Empty) }; #endregion @@ -804,9 +804,13 @@ namespace UmbracoExamine /// /// protected override FieldIndexTypes GetPolicy(string fieldName) - { - var def = IndexFieldPolicies.Where(x => x.Name == fieldName).ToArray(); - return (def.Any() == false ? FieldIndexTypes.ANALYZED : def.Single().IndexType); + { + StaticField def; + if (IndexFieldPolicies.TryGetValue(fieldName, out def)) + { + return def.IndexType; + } + return FieldIndexTypes.ANALYZED; } /// @@ -816,14 +820,18 @@ namespace UmbracoExamine /// protected override bool ValidateDocument(XElement node) { - var nodeId = int.Parse(node.Attribute("id").Value); // Test for access if we're only indexing published content // return nothing if we're not supporting protected content and it is protected, and we're not supporting unpublished content - if (!SupportUnpublishedContent - && (!SupportProtectedContent - && DataService.ContentService.IsProtected(nodeId, node.Attribute("path").Value))) + if (SupportUnpublishedContent == false + && SupportProtectedContent == false) { - return false; + + var nodeId = int.Parse(node.Attribute("id").Value); + + if (DataService.ContentService.IsProtected(nodeId, node.Attribute("path").Value)) + { + return false; + } } return base.ValidateDocument(node); } diff --git a/src/UmbracoExamine/UmbracoExamine.csproj b/src/UmbracoExamine/UmbracoExamine.csproj index 8720849744..25c1f1bcf0 100644 --- a/src/UmbracoExamine/UmbracoExamine.csproj +++ b/src/UmbracoExamine/UmbracoExamine.csproj @@ -134,6 +134,7 @@ + diff --git a/src/UmbracoExamine/UmbracoMemberIndexer.cs b/src/UmbracoExamine/UmbracoMemberIndexer.cs index 2e48dff64e..ad393932be 100644 --- a/src/UmbracoExamine/UmbracoMemberIndexer.cs +++ b/src/UmbracoExamine/UmbracoMemberIndexer.cs @@ -117,8 +117,9 @@ namespace UmbracoExamine if (indexerData.UserFields.Any(x => x.Name == "_searchEmail") == false) { var field = new IndexField { Name = "_searchEmail" }; - var policy = IndexFieldPolicies.FirstOrDefault(x => x.Name == "_searchEmail"); - if (policy != null) + + StaticField policy; + if (IndexFieldPolicies.TryGetValue("_searchEmail", out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; @@ -237,10 +238,16 @@ namespace UmbracoExamine { var fields = base.GetSpecialFieldsToIndex(allValuesForIndexing); - //adds the special path property to the index + //adds the special key property to the index string valuesForIndexing; if (allValuesForIndexing.TryGetValue("__key", out valuesForIndexing)) - fields.Add("__key", valuesForIndexing); + { + if (fields.ContainsKey("__key") == false) + { + fields.Add("__key", valuesForIndexing); + } + } + return fields; From 1d43cf491bc759bec15cb7434f71301527f9028e Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 2 Feb 2017 14:09:49 +1100 Subject: [PATCH 02/12] U4-9448 Slave Front End server requires write access to database when master performs unpublish --- src/Umbraco.Web/umbraco.presentation/content.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index 00d1984d12..1a91adff02 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -424,10 +424,7 @@ namespace umbraco if (!e.Cancel) { XmlNode x; - - // remove from xml db cache - doc.XmlRemoveFromDB(); - + // clear xml cache ClearDocumentXmlCache(doc.Id); From ce69497a68722cde32db9e762e04a3084081e2fd Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 2 Feb 2017 14:16:39 +1100 Subject: [PATCH 03/12] Update code to have zero breaking changes for old public APIs --- src/Umbraco.Web/Cache/PageCacheRefresher.cs | 4 ++-- .../umbraco.presentation/content.cs | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/Cache/PageCacheRefresher.cs b/src/Umbraco.Web/Cache/PageCacheRefresher.cs index 75118a6748..fc6e0c8d20 100644 --- a/src/Umbraco.Web/Cache/PageCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/PageCacheRefresher.cs @@ -74,7 +74,7 @@ namespace Umbraco.Web.Cache public override void Remove(int id) { ApplicationContext.Current.ApplicationCache.ClearPartialViewCache(); - content.Instance.ClearDocumentCache(id); + content.Instance.ClearDocumentCache(id, false); DistributedCache.Instance.ClearAllMacroCacheOnCurrentServer(); DistributedCache.Instance.ClearXsltCacheOnCurrentServer(); ClearAllIsolatedCacheByEntityType(); @@ -95,7 +95,7 @@ namespace Umbraco.Web.Cache public override void Remove(IContent instance) { ApplicationContext.Current.ApplicationCache.ClearPartialViewCache(); - content.Instance.ClearDocumentCache(new Document(instance)); + content.Instance.ClearDocumentCache(new Document(instance), false); XmlPublishedContent.ClearRequest(); DistributedCache.Instance.ClearAllMacroCacheOnCurrentServer(); DistributedCache.Instance.ClearXsltCacheOnCurrentServer(); diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index 1a91adff02..a7c5a75337 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -394,6 +394,11 @@ namespace umbraco } public virtual void ClearDocumentCache(int documentId) + { + ClearDocumentCache(documentId, true); + } + + internal virtual void ClearDocumentCache(int documentId, bool removeDbXmlEntry) { // Get the document Document d; @@ -408,7 +413,7 @@ namespace umbraco ClearDocumentXmlCache(documentId); return; } - ClearDocumentCache(d); + ClearDocumentCache(d, removeDbXmlEntry); } /// @@ -416,7 +421,8 @@ namespace umbraco /// This means the node gets unpublished from the website. /// /// The document - internal void ClearDocumentCache(Document doc) + /// + internal void ClearDocumentCache(Document doc, bool removeDbXmlEntry) { var e = new DocumentCacheEventArgs(); FireBeforeClearDocumentCache(doc, e); @@ -424,7 +430,15 @@ namespace umbraco if (!e.Cancel) { XmlNode x; - + + //Hack: this is here purely for backwards compat if someone for some reason is using the + // ClearDocumentCache(int documentId) method and expecting it to remove the xml + if (removeDbXmlEntry) + { + // remove from xml db cache + doc.XmlRemoveFromDB(); + } + // clear xml cache ClearDocumentXmlCache(doc.Id); From 882d5ec7f517ddcb2944fed241d5de424f88cde1 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 2 Feb 2017 16:02:29 +1100 Subject: [PATCH 04/12] missing null check --- src/UmbracoExamine/StaticFieldCollection.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/UmbracoExamine/StaticFieldCollection.cs b/src/UmbracoExamine/StaticFieldCollection.cs index 2b54eb8043..909271e0b5 100644 --- a/src/UmbracoExamine/StaticFieldCollection.cs +++ b/src/UmbracoExamine/StaticFieldCollection.cs @@ -17,6 +17,11 @@ namespace UmbracoExamine /// public bool TryGetValue(string key, out StaticField field) { + if (Dictionary == null) + { + field = null; + return false; + } return Dictionary.TryGetValue(key, out field); } } From 32892cf5e07bfadf1e6697d5a904c6c32b8b766c Mon Sep 17 00:00:00 2001 From: hartvig Date: Thu, 2 Feb 2017 10:05:14 +0100 Subject: [PATCH 05/12] Update NewInstallStep.cs --- src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs index fd36d8e4e6..85dd58d697 100644 --- a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs @@ -81,7 +81,7 @@ namespace Umbraco.Web.Install.InstallSteps { var client = new System.Net.WebClient(); var values = new NameValueCollection { { "name", admin.Name }, { "email", admin.Email} }; - client.UploadValues("https://umbraco.com/base/Ecom/SubmitEmail/installer.aspx", values); + client.UploadValues("https://shop.umbraco.com/base/Ecom/SubmitEmail/installer.aspx", values); } catch { /* fail in silence */ } } @@ -147,4 +147,4 @@ namespace Umbraco.Web.Install.InstallSteps } } } -} \ No newline at end of file +} From d598fdce54e25758ec7c172dc4d5876ecc32235f Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 3 Feb 2017 12:03:56 +1100 Subject: [PATCH 06/12] Updates to latest Examine release --- src/Umbraco.Tests/Umbraco.Tests.csproj | 5 ++--- src/Umbraco.Tests/packages.config | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 5 ++--- src/Umbraco.Web.UI/packages.config | 2 +- src/Umbraco.Web/Umbraco.Web.csproj | 5 ++--- src/Umbraco.Web/packages.config | 2 +- src/UmbracoExamine/UmbracoExamine.csproj | 5 ++--- src/UmbracoExamine/packages.config | 2 +- src/umbraco.MacroEngines/packages.config | 2 +- src/umbraco.MacroEngines/umbraco.MacroEngines.csproj | 5 ++--- 10 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index f0fb6f5921..84d14dabcf 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -57,9 +57,8 @@ ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll diff --git a/src/Umbraco.Tests/packages.config b/src/Umbraco.Tests/packages.config index b71ba7a170..09765d376b 100644 --- a/src/Umbraco.Tests/packages.config +++ b/src/Umbraco.Tests/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 470541b88c..55b6c3c671 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -127,9 +127,8 @@ False ..\packages\dotless.1.4.1.0\lib\dotless.Core.dll - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll False diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index 629438762f..1ea477f5cb 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -4,7 +4,7 @@ - + diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index b66fa8174a..06791f204c 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -112,9 +112,8 @@ ..\packages\dotless.1.4.1.0\lib\dotless.Core.dll - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll diff --git a/src/Umbraco.Web/packages.config b/src/Umbraco.Web/packages.config index 9490486e9a..6d32c08bdd 100644 --- a/src/Umbraco.Web/packages.config +++ b/src/Umbraco.Web/packages.config @@ -3,7 +3,7 @@ - + diff --git a/src/UmbracoExamine/UmbracoExamine.csproj b/src/UmbracoExamine/UmbracoExamine.csproj index 25c1f1bcf0..34b99ddf9a 100644 --- a/src/UmbracoExamine/UmbracoExamine.csproj +++ b/src/UmbracoExamine/UmbracoExamine.csproj @@ -82,9 +82,8 @@ ..\Solution Items\TheFARM-Public.snk - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll diff --git a/src/UmbracoExamine/packages.config b/src/UmbracoExamine/packages.config index 0c85a9c3ca..81a5d495c4 100644 --- a/src/UmbracoExamine/packages.config +++ b/src/UmbracoExamine/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/umbraco.MacroEngines/packages.config b/src/umbraco.MacroEngines/packages.config index 930b7adbb0..fdd7b5d593 100644 --- a/src/umbraco.MacroEngines/packages.config +++ b/src/umbraco.MacroEngines/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj index 198867a5d6..8684da25af 100644 --- a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj +++ b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj @@ -45,9 +45,8 @@ false - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll From 5a8e37f5b438ae56a23eebc630517f16d6e136d7 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 6 Feb 2017 13:46:10 +0100 Subject: [PATCH 07/12] U4-9492 Update to latest ImageProcessor --- build/NuSpecs/UmbracoCms.Core.nuspec | 4 ++-- src/Umbraco.Core/Umbraco.Core.csproj | 5 +++-- src/Umbraco.Core/packages.config | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 12 +++++++----- src/Umbraco.Web.UI/packages.config | 6 +++--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 3c65f6f145..68f79d4a9a 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -33,8 +33,8 @@ - - + + diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 8ba327c9c9..2e8fc0fd39 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -49,8 +49,9 @@ ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll + + ..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll + True ..\packages\log4net-mediumtrust.2.0.0\lib\log4net.dll diff --git a/src/Umbraco.Core/packages.config b/src/Umbraco.Core/packages.config index 221e4063f6..01a4d71f82 100644 --- a/src/Umbraco.Core/packages.config +++ b/src/Umbraco.Core/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 470541b88c..662ee6d8ab 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -135,11 +135,12 @@ False ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll + + ..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll + True - - ..\packages\ImageProcessor.Web.4.8.0\lib\net45\ImageProcessor.Web.dll + + ..\packages\ImageProcessor.Web.4.8.2\lib\net45\ImageProcessor.Web.dll True @@ -168,7 +169,8 @@ - ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.0\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll + ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll + True ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index 629438762f..f36a3e3c87 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -5,8 +5,8 @@ - - + + @@ -22,7 +22,7 @@ - + From fa8f3985b85c7378e47e5d63f5990403dd9fb5d6 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 7 Feb 2017 12:33:37 +1100 Subject: [PATCH 08/12] Fixes database context issue during startup when there is no db configured --- src/Umbraco.Core/DatabaseContext.cs | 11 +++++++++-- src/Umbraco.Core/Persistence/PetaPoco.cs | 4 ++-- src/Umbraco.Core/UmbracoApplicationBase.cs | 10 ++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index d4a5a309af..e350fd2446 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -98,7 +98,14 @@ namespace Umbraco.Core /// public virtual UmbracoDatabase Database { - get { return _factory.CreateDatabase(); } + get + { + if (IsDatabaseConfigured == false) + { + throw new InvalidOperationException("Cannot create a database instance, there is no available connection string"); + } + return _factory.CreateDatabase(); + } } /// @@ -164,7 +171,7 @@ namespace Umbraco.Core } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + GlobalSettings.UmbracoConnectionName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); } return _providerName; } diff --git a/src/Umbraco.Core/Persistence/PetaPoco.cs b/src/Umbraco.Core/Persistence/PetaPoco.cs index 88ff456ff6..772250ccd6 100644 --- a/src/Umbraco.Core/Persistence/PetaPoco.cs +++ b/src/Umbraco.Core/Persistence/PetaPoco.cs @@ -167,12 +167,12 @@ namespace Umbraco.Core.Persistence var providerName = Constants.DatabaseProviders.SqlServer; if (ConfigurationManager.ConnectionStrings[connectionStringName] != null) { - if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName)) + if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName) == false) providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName; } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + connectionStringName + "'"); } // Store factory and connection string diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index e4574a7972..c4391653e6 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -59,6 +59,16 @@ namespace Umbraco.Core //And now we can dispose of our startup handlers - save some memory ApplicationEventsResolver.Current.Dispose(); + + // after Umbraco has started there is a database in "context" and that context is + // going to stay there and never get destroyed nor reused, so we have to ensure that + // the database is disposed (which will auto-remove it from context). + if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured) + { + var database = ApplicationContext.Current.DatabaseContext.Database; + if (database != null) // never to happen... unless in weird tests + ApplicationContext.Current.DatabaseContext.Database.Dispose(); + } } /// From ab3bfa4e929b1f4a8c85098faae614ee926d17b9 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 7 Feb 2017 12:39:35 +1100 Subject: [PATCH 09/12] Fixes database context issue during startup when there is no db configured --- src/Umbraco.Core/DatabaseContext.cs | 11 +++++++++-- src/Umbraco.Core/Persistence/PetaPoco.cs | 4 ++-- src/Umbraco.Core/UmbracoApplicationBase.cs | 9 ++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index 837e59ca12..b48ab1bca4 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -110,7 +110,14 @@ namespace Umbraco.Core /// public virtual UmbracoDatabase Database { - get { return _factory.CreateDatabase(); } + get + { + if (IsDatabaseConfigured == false) + { + throw new InvalidOperationException("Cannot create a database instance, there is no available connection string"); + } + return _factory.CreateDatabase(); + } } /// @@ -202,7 +209,7 @@ namespace Umbraco.Core } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); } return _providerName; } diff --git a/src/Umbraco.Core/Persistence/PetaPoco.cs b/src/Umbraco.Core/Persistence/PetaPoco.cs index b569b1c45d..ba44af2c28 100644 --- a/src/Umbraco.Core/Persistence/PetaPoco.cs +++ b/src/Umbraco.Core/Persistence/PetaPoco.cs @@ -167,12 +167,12 @@ namespace Umbraco.Core.Persistence var providerName = Constants.DatabaseProviders.SqlServer; if (ConfigurationManager.ConnectionStrings[connectionStringName] != null) { - if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName)) + if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName) == false) providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName; } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + connectionStringName + "'"); } // Store factory and connection string diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index 1bf90fb154..7f1f0803f8 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -63,9 +63,12 @@ namespace Umbraco.Core // after Umbraco has started there is a database in "context" and that context is // going to stay there and never get destroyed nor reused, so we have to ensure that // the database is disposed (which will auto-remove it from context). - var database = ApplicationContext.Current.DatabaseContext.Database; - if (database != null) // never to happen... unless in weird tests - ApplicationContext.Current.DatabaseContext.Database.Dispose(); + if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured) + { + var database = ApplicationContext.Current.DatabaseContext.Database; + if (database != null) // never to happen... unless in weird tests + ApplicationContext.Current.DatabaseContext.Database.Dispose(); + } } /// From 92ce064d3036eec5fa1d2f3407efe5b576258ffd Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 7 Feb 2017 12:40:28 +1100 Subject: [PATCH 10/12] DOH! Revert "Fixes database context issue during startup when there is no db configured" pushed to the wrong branch --- src/Umbraco.Core/DatabaseContext.cs | 11 ++--------- src/Umbraco.Core/Persistence/PetaPoco.cs | 4 ++-- src/Umbraco.Core/UmbracoApplicationBase.cs | 10 ---------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index b48ab1bca4..5708b03c22 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -110,14 +110,7 @@ namespace Umbraco.Core /// public virtual UmbracoDatabase Database { - get - { - if (IsDatabaseConfigured == false) - { - throw new InvalidOperationException("Cannot create a database instance, there is no available connection string"); - } - return _factory.CreateDatabase(); - } + get { return _factory.CreateDatabase(); } } /// @@ -209,7 +202,7 @@ namespace Umbraco.Core } else { - throw new NullReferenceException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); + throw new InvalidOperationException("Can't find a connection string with the name '" + GlobalSettings.UmbracoConnectionName + "'"); } return _providerName; } diff --git a/src/Umbraco.Core/Persistence/PetaPoco.cs b/src/Umbraco.Core/Persistence/PetaPoco.cs index ba44af2c28..b569b1c45d 100644 --- a/src/Umbraco.Core/Persistence/PetaPoco.cs +++ b/src/Umbraco.Core/Persistence/PetaPoco.cs @@ -167,12 +167,12 @@ namespace Umbraco.Core.Persistence var providerName = Constants.DatabaseProviders.SqlServer; if (ConfigurationManager.ConnectionStrings[connectionStringName] != null) { - if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName) == false) + if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName)) providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName; } else { - throw new NullReferenceException("Can't find a connection string with the name '" + connectionStringName + "'"); + throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'"); } // Store factory and connection string diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index 7f1f0803f8..92f5a476f9 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -59,16 +59,6 @@ namespace Umbraco.Core //And now we can dispose of our startup handlers - save some memory ApplicationEventsResolver.Current.Dispose(); - - // after Umbraco has started there is a database in "context" and that context is - // going to stay there and never get destroyed nor reused, so we have to ensure that - // the database is disposed (which will auto-remove it from context). - if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured) - { - var database = ApplicationContext.Current.DatabaseContext.Database; - if (database != null) // never to happen... unless in weird tests - ApplicationContext.Current.DatabaseContext.Database.Dispose(); - } } /// From 138991d951b2d53c39f899bf69cd9f8c06c9c553 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 7 Feb 2017 12:43:06 +1100 Subject: [PATCH 11/12] OMG Re-rever "DOH! Revert "Fixes database context issue during startup when there is no db configured", i reverted the wrong commit on the wrong branch --- src/Umbraco.Core/DatabaseContext.cs | 11 +++++++++-- src/Umbraco.Core/Persistence/PetaPoco.cs | 4 ++-- src/Umbraco.Core/UmbracoApplicationBase.cs | 10 ++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index 5708b03c22..b48ab1bca4 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -110,7 +110,14 @@ namespace Umbraco.Core /// public virtual UmbracoDatabase Database { - get { return _factory.CreateDatabase(); } + get + { + if (IsDatabaseConfigured == false) + { + throw new InvalidOperationException("Cannot create a database instance, there is no available connection string"); + } + return _factory.CreateDatabase(); + } } /// @@ -202,7 +209,7 @@ namespace Umbraco.Core } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + GlobalSettings.UmbracoConnectionName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); } return _providerName; } diff --git a/src/Umbraco.Core/Persistence/PetaPoco.cs b/src/Umbraco.Core/Persistence/PetaPoco.cs index b569b1c45d..ba44af2c28 100644 --- a/src/Umbraco.Core/Persistence/PetaPoco.cs +++ b/src/Umbraco.Core/Persistence/PetaPoco.cs @@ -167,12 +167,12 @@ namespace Umbraco.Core.Persistence var providerName = Constants.DatabaseProviders.SqlServer; if (ConfigurationManager.ConnectionStrings[connectionStringName] != null) { - if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName)) + if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName) == false) providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName; } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + connectionStringName + "'"); } // Store factory and connection string diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index 92f5a476f9..7f1f0803f8 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -59,6 +59,16 @@ namespace Umbraco.Core //And now we can dispose of our startup handlers - save some memory ApplicationEventsResolver.Current.Dispose(); + + // after Umbraco has started there is a database in "context" and that context is + // going to stay there and never get destroyed nor reused, so we have to ensure that + // the database is disposed (which will auto-remove it from context). + if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured) + { + var database = ApplicationContext.Current.DatabaseContext.Database; + if (database != null) // never to happen... unless in weird tests + ApplicationContext.Current.DatabaseContext.Database.Dispose(); + } } /// From f816a63b541dfb3869c41db64c297ae2f63e76d3 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 7 Feb 2017 12:49:26 +1100 Subject: [PATCH 12/12] Ok, reverting the correct commit this time: Revert "Fixes database context issue during startup when there is no db configured" --- src/Umbraco.Core/DatabaseContext.cs | 11 ++--------- src/Umbraco.Core/Persistence/PetaPoco.cs | 4 ++-- src/Umbraco.Core/UmbracoApplicationBase.cs | 10 ---------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index e350fd2446..d4a5a309af 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -98,14 +98,7 @@ namespace Umbraco.Core /// public virtual UmbracoDatabase Database { - get - { - if (IsDatabaseConfigured == false) - { - throw new InvalidOperationException("Cannot create a database instance, there is no available connection string"); - } - return _factory.CreateDatabase(); - } + get { return _factory.CreateDatabase(); } } /// @@ -171,7 +164,7 @@ namespace Umbraco.Core } else { - throw new NullReferenceException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); + throw new InvalidOperationException("Can't find a connection string with the name '" + GlobalSettings.UmbracoConnectionName + "'"); } return _providerName; } diff --git a/src/Umbraco.Core/Persistence/PetaPoco.cs b/src/Umbraco.Core/Persistence/PetaPoco.cs index 772250ccd6..88ff456ff6 100644 --- a/src/Umbraco.Core/Persistence/PetaPoco.cs +++ b/src/Umbraco.Core/Persistence/PetaPoco.cs @@ -167,12 +167,12 @@ namespace Umbraco.Core.Persistence var providerName = Constants.DatabaseProviders.SqlServer; if (ConfigurationManager.ConnectionStrings[connectionStringName] != null) { - if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName) == false) + if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName)) providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName; } else { - throw new NullReferenceException("Can't find a connection string with the name '" + connectionStringName + "'"); + throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'"); } // Store factory and connection string diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index c4391653e6..e4574a7972 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -59,16 +59,6 @@ namespace Umbraco.Core //And now we can dispose of our startup handlers - save some memory ApplicationEventsResolver.Current.Dispose(); - - // after Umbraco has started there is a database in "context" and that context is - // going to stay there and never get destroyed nor reused, so we have to ensure that - // the database is disposed (which will auto-remove it from context). - if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured) - { - var database = ApplicationContext.Current.DatabaseContext.Database; - if (database != null) // never to happen... unless in weird tests - ApplicationContext.Current.DatabaseContext.Database.Dispose(); - } } ///