From 849a9892c5ec4523c9ad35325f94a69b5db32796 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 12 Dec 2012 09:07:06 -0100 Subject: [PATCH 1/8] #U4-1246 Increase the version number in ClientDependency.config after install --- .../ClientDependencyConfiguration.cs | 50 +++++++++++++++++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + .../install/steps/theend.ascx.cs | 4 ++ 3 files changed, 55 insertions(+) create mode 100644 src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs diff --git a/src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs b/src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs new file mode 100644 index 0000000000..3aa4321071 --- /dev/null +++ b/src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs @@ -0,0 +1,50 @@ +using System; +using System.Linq; +using System.Xml.Linq; +using Umbraco.Core.IO; +using Umbraco.Core.Logging; + +namespace Umbraco.Core.Configuration +{ + internal class ClientDependencyConfiguration + { + private readonly string _fileName; + + public ClientDependencyConfiguration() + { + _fileName = IOHelper.MapPath(string.Format("{0}/ClientDependency.config", SystemDirectories.Config)); + } + + /// + /// Increases the version number in ClientDependency.config by 1 + /// + internal bool IncreaseVersionNumber() + { + try + { + var clientDependencyConfigXml = XDocument.Load(_fileName, LoadOptions.PreserveWhitespace); + if (clientDependencyConfigXml.Root != null) + { + + var versionAttribute = clientDependencyConfigXml.Root.Attribute("version"); + + int oldVersion; + int.TryParse(versionAttribute.Value, out oldVersion); + var newVersion = oldVersion + 1; + + versionAttribute.SetValue(newVersion); + clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting); + + LogHelper.Info(string.Format("Updated version number from {0} to {1}", oldVersion, newVersion)); + return true; + } + } + catch (Exception ex) + { + LogHelper.Error("Couldn't update ClientDependency version number", ex); + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index e1171b5b18..0fd1493b0b 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -105,6 +105,7 @@ + diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/theend.ascx.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/theend.ascx.cs index 5e3d5b3fdf..66d88de694 100644 --- a/src/Umbraco.Web/umbraco.presentation/install/steps/theend.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/install/steps/theend.ascx.cs @@ -33,6 +33,10 @@ namespace umbraco.presentation.install.steps //errorLiteral.Text = ex.ToString(); } + // Update ClientDependency version + var clientDependencyConfig = new ClientDependencyConfiguration(); + var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber(); + if (!cms.businesslogic.skinning.Skinning.IsStarterKitInstalled()) customizeSite.Visible = false; From 23fff9be8c24ba298f66a1e25c208f2241408994 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 12 Dec 2012 10:25:34 -0100 Subject: [PATCH 2/8] Remove the legacy Cache Browser --- .../config/trees.Release.config | 2 - src/Umbraco.Web.UI/config/trees.config | 2 - src/Umbraco.Web/Umbraco.Web.csproj | 2 - .../umbraco/Trees/loadCache.cs | 90 ----------------- .../umbraco/Trees/loadCacheItem.cs | 98 ------------------- 5 files changed, 194 deletions(-) delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCache.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCacheItem.cs diff --git a/src/Umbraco.Web.UI/config/trees.Release.config b/src/Umbraco.Web.UI/config/trees.Release.config index aa1792c298..861161d69f 100644 --- a/src/Umbraco.Web.UI/config/trees.Release.config +++ b/src/Umbraco.Web.UI/config/trees.Release.config @@ -20,8 +20,6 @@ - - diff --git a/src/Umbraco.Web.UI/config/trees.config b/src/Umbraco.Web.UI/config/trees.config index 3d6797386d..e73f851257 100644 --- a/src/Umbraco.Web.UI/config/trees.config +++ b/src/Umbraco.Web.UI/config/trees.config @@ -16,8 +16,6 @@ - - diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 26e75659f8..d53a84f417 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1660,8 +1660,6 @@ - - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCache.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCache.cs deleted file mode 100644 index 8e57a309b1..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCache.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Text; -using System.Web; -using System.Xml; -using System.Configuration; -using umbraco.BasePages; -using umbraco.BusinessLogic; -using umbraco.businesslogic; -using umbraco.cms.businesslogic; -using umbraco.cms.businesslogic.cache; -using umbraco.cms.businesslogic.contentitem; -using umbraco.cms.businesslogic.datatype; -using umbraco.cms.businesslogic.language; -using umbraco.cms.businesslogic.media; -using umbraco.cms.businesslogic.member; -using umbraco.cms.businesslogic.property; -using umbraco.cms.businesslogic.web; -using umbraco.interfaces; -using umbraco.DataLayer; -using umbraco.BusinessLogic.Utils; -using umbraco.cms.presentation.Trees; -using umbraco.BusinessLogic.Actions; - - -namespace umbraco -{ - /// - /// Handles loading of the cache application into the developer application tree - /// - [Tree("developer", "cacheBrowser", "Cache Browser")] - public class loadCache : BaseTree - { - public loadCache(string application) : base(application) { } - - protected override void CreateRootNode(ref XmlTreeNode rootNode) - { - rootNode.NodeType = "init" + TreeAlias; - rootNode.NodeID = "init"; - } - - protected override void CreateRootNodeActions(ref List actions) - { - actions.Clear(); - actions.Add(ActionRefresh.Instance); - } - - protected override void CreateAllowedActions(ref List actions) - { - actions.Clear(); - actions.Add(ActionRefresh.Instance); - } - - public override void RenderJS(ref StringBuilder Javascript) { } - - public override void Render(ref XmlTree tree) - { - Hashtable ht = Cache.ReturnCacheItemsOrdred(); - - foreach (string key in ht.Keys) - { - //each child will need to load a CacheItem instead of a Cache tree so - //we'll create a loadCacheItem object in order to get it's serivce url and alias properties - loadCacheItem loadCacheItemTree = new loadCacheItem(this.app); - int itemCount = ((ArrayList)ht[key]).Count; - XmlTreeNode xNode = XmlTreeNode.Create(loadCacheItemTree); - xNode.NodeID = key; - xNode.Text = key + " (" + itemCount + ")"; - xNode.Action = string.Empty; - xNode.Source = loadCacheItemTree.GetTreeServiceUrl(key); - xNode.Icon = "developerCacheTypes.gif"; - xNode.OpenIcon = "developerCacheTypes.gif"; - xNode.HasChildren = itemCount > 0; - - OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty); - if (xNode != null) - { - tree.Add(xNode); - OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty); - } - - } - } - - } - -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCacheItem.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCacheItem.cs deleted file mode 100644 index 4c6a670052..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadCacheItem.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Text; -using System.Web; -using System.Xml; -using System.Configuration; -using umbraco.BasePages; -using umbraco.BusinessLogic; -using umbraco.businesslogic; -using umbraco.cms.businesslogic; -using umbraco.cms.businesslogic.cache; -using umbraco.cms.businesslogic.contentitem; -using umbraco.cms.businesslogic.datatype; -using umbraco.cms.businesslogic.language; -using umbraco.cms.businesslogic.media; -using umbraco.cms.businesslogic.member; -using umbraco.cms.businesslogic.property; -using umbraco.cms.businesslogic.web; -using umbraco.interfaces; -using umbraco.DataLayer; -using umbraco.BusinessLogic.Utils; -using umbraco.cms.presentation.Trees; -using umbraco.BusinessLogic.Actions; - - -namespace umbraco -{ - /// - /// Handles loading of each individual cache items into the application tree under the cache application - /// - [Tree("developer", "CacheItem", "Cache Item", initialize: false)] - public class loadCacheItem : BaseTree - { - public loadCacheItem(string application) : base(application) { } - - protected override void CreateRootNode(ref XmlTreeNode rootNode) - { - rootNode.NodeType = "init" + TreeAlias; - rootNode.NodeID = "init"; - } - - protected override void CreateRootNodeActions(ref List actions) - { - actions.Clear(); - actions.Add(ActionRefresh.Instance); - } - - protected override void CreateAllowedActions(ref List actions) - { - actions.Clear(); - actions.Add(ActionRefresh.Instance); - } - - /// - /// Renders the javascript. - /// - /// The javascript. - public override void RenderJS(ref StringBuilder Javascript) - { - Javascript.Append( - @" -function openCacheItem(id) { - UmbClientMgr.contentFrame('developer/cache/viewCacheItem.aspx?key=' + id); -} -"); - } - - public override void Render(ref XmlTree tree) - { - Hashtable ht = Cache.ReturnCacheItemsOrdred(); - - ArrayList a = (ArrayList)ht[this.NodeKey]; - - for (int i = 0; i < a.Count; i++) - { - XmlTreeNode xNode = XmlTreeNode.Create(this); - xNode.NodeID = a[i].ToString(); - xNode.Text = a[i].ToString(); - xNode.Action = "javascript:openCacheItem('" + a[i] + "');"; - xNode.Icon = "developerCacheItem.gif"; - xNode.OpenIcon = "developerCacheItem.gif"; - - OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty); - if (xNode != null) - { - tree.Add(xNode); - OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty); - } - - } - } - - } - -} From c3c3c3856f9a738fd58321259b08d9f1f06d8a0d Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 12 Dec 2012 12:26:28 -0100 Subject: [PATCH 3/8] Update unit tests to reflect removal of cachebrowser trees --- src/Umbraco.Tests/PluginManagerTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Tests/PluginManagerTests.cs b/src/Umbraco.Tests/PluginManagerTests.cs index 4b690d6271..3bbd495fc4 100644 --- a/src/Umbraco.Tests/PluginManagerTests.cs +++ b/src/Umbraco.Tests/PluginManagerTests.cs @@ -268,7 +268,7 @@ namespace Umbraco.Tests public void Resolves_Attributed_Trees() { var trees = PluginManager.Current.ResolveAttributedTrees(); - Assert.AreEqual(27, trees.Count()); + Assert.AreEqual(25, trees.Count()); } [Test] @@ -282,7 +282,7 @@ namespace Umbraco.Tests public void Resolves_Trees() { var trees = PluginManager.Current.ResolveTrees(); - Assert.AreEqual(36, trees.Count()); + Assert.AreEqual(34, trees.Count()); } [Test] From 21ead72d481e2d7f3d69ccd7a060c88435048d62 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 12 Dec 2012 12:40:18 -0100 Subject: [PATCH 4/8] Add en_us files in VS project file so they'll actually be in the built zip file --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 09bd34d63e..a7faf4ab0b 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -399,6 +399,7 @@ UI.xml + @@ -639,6 +640,7 @@ + @@ -658,6 +660,7 @@ + @@ -679,6 +682,7 @@ + @@ -697,6 +701,7 @@ + @@ -718,6 +723,7 @@ + @@ -747,6 +753,7 @@ + @@ -775,6 +782,7 @@ + @@ -827,13 +835,20 @@ + + + + + + + @@ -849,6 +864,7 @@ + @@ -878,6 +894,7 @@ + @@ -901,6 +918,7 @@ + @@ -929,6 +947,7 @@ + @@ -951,6 +970,7 @@ + @@ -970,6 +990,8 @@ + + @@ -982,6 +1004,8 @@ + + @@ -989,6 +1013,7 @@ + @@ -996,6 +1021,7 @@ + @@ -1006,6 +1032,8 @@ + + @@ -1043,6 +1071,7 @@ + @@ -1173,6 +1202,8 @@ + + From e2eee711d8d071aa53cb43560142057cb3570241 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 13 Dec 2012 09:26:34 -0100 Subject: [PATCH 5/8] Fixes U4-483 - Replace illegal characters in media with a dash, not underscore Also removing multiple repeating dashes, leaving only one in place. --- src/Umbraco.Core/IO/IOHelper.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 095759eea9..f3b2536cc1 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -222,7 +222,7 @@ namespace Umbraco.Core.IO { foreach (var character in Path.GetInvalidFileNameChars()) { - filePath = filePath.Replace(character, '_'); + filePath = filePath.Replace(character, '-'); } } else @@ -242,10 +242,14 @@ namespace Umbraco.Core.IO if (reservedCharacters.IndexOf(character) == -1) stringBuilder.Append(character); else - stringBuilder.Append("_"); + stringBuilder.Append("-"); } - return stringBuilder.ToString(); + // Remove repeating dashes + // From: http://stackoverflow.com/questions/5111967/regex-to-remove-a-specific-repeated-character + var reducedString = Regex.Replace(stringBuilder.ToString(), "-+", "-"); + + return reducedString; } } } From a5775e5a2708c7ceeec66f269f4fd39d1b32be83 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 13 Dec 2012 10:44:21 -0100 Subject: [PATCH 6/8] Also add FixedDisplayModes package as NuGet dependency --- build/NuSpecs/UmbracoCms.Core.nuspec | 1 + 1 file changed, 1 insertion(+) diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 1b46661d82..a42f103856 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -17,6 +17,7 @@ + From b1091f91dc8a74f71b2edf9f47067bf69d914848 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 13 Dec 2012 15:48:18 -0100 Subject: [PATCH 7/8] Fixes U4-1320 - Dictionary delete query isn't paremterized --- src/umbraco.cms/businesslogic/Dictionary.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs index 3d11d9e855..80646d9f65 100644 --- a/src/umbraco.cms/businesslogic/Dictionary.cs +++ b/src/umbraco.cms/businesslogic/Dictionary.cs @@ -359,7 +359,7 @@ namespace umbraco.cms.businesslogic Item.removeText(UniqueId); // remove key from database - SqlHelper.ExecuteNonQuery("delete from cmsDictionary where [key] ='" + key + "'"); + SqlHelper.ExecuteNonQuery("delete from cmsDictionary where [key] = @key", SqlHelper.CreateParameter("@key", key)); // Remove key from cache DictionaryItems.Remove(key); From 3a93da6256ebd6d8dea07a40efe193e00ebda8b6 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 13 Dec 2012 15:48:46 -0100 Subject: [PATCH 8/8] U4-1212, U4-1312 - fix Document.PathPublished --- src/umbraco.cms/businesslogic/web/Document.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 2b3df3fe79..636b1900e6 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -778,11 +778,15 @@ namespace umbraco.cms.businesslogic.web { get { + // get all nodes in the path to the document, and get all matching published documents + // the difference should be zero if everything is published + // test nodeObjectType to make sure we only count _content_ nodes int x = SqlHelper.ExecuteScalar(@"select count(node.id) - count(doc.nodeid) from umbracoNode as node left join cmsDocument as doc on (node.id=doc.nodeId and doc.published=1) -where '" + Path + ",' like " + SqlHelper.Concat("node.path", "',%'")); - return (x == 1); +where '" + Path + ",' like " + SqlHelper.Concat("node.path", "',%'") + @" +and node.nodeObjectType='C66BA18E-EAF3-4CFF-8A22-41B16D66A972'"); + return (x == 0); } }