From 169c6b63729e4468fc4e093abebad708e7336a22 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Sat, 25 Mar 2017 12:50:53 +0000 Subject: [PATCH 1/5] Fixes U4-9678 - XPath Syntax Parser slowdown http://issues.umbraco.org/issue/U4-9678 Swaps out the base XPath from `"descendant::*[@id={0}]"` to `"id({0})"` - making use of the content-cache's XML DTD ID index. This will perform better on larger content-trees. --- src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs b/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs index 7802ddc438..016a3e45dd 100644 --- a/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs +++ b/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs @@ -60,7 +60,7 @@ namespace Umbraco.Core.Xml return -1; }); - const string rootXpath = "descendant::*[@id={0}]"; + const string rootXpath = "id({0})"; //parseable items: var vars = new Dictionary>(); From 394f21f4bef7e74fd849364acc50751fcddd7ab2 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 12 Sep 2017 10:38:09 +0200 Subject: [PATCH 2/5] Make it possible for the build server to set an alpha build version --- .../Set-UmbracoContinuousVersion.ps1 | 33 +++++++++++++++++++ .../Modules/Umbraco.Build/Umbraco.Build.psm1 | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 diff --git a/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 b/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 new file mode 100644 index 0000000000..f080940104 --- /dev/null +++ b/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 @@ -0,0 +1,33 @@ +# +# Set-UmbracoContinuousVersion +# Sets the Umbraco version for continuous integration +# +# -Version +# where is a Semver valid version +# eg 1.2.3, 1.2.3-alpha, 1.2.3-alpha+456 +# +# -BuildNumber +# where is an integer coming from the build server +# +function Set-UmbracoContinuousVersion +{ + param ( + [Parameter(Mandatory=$true)] + [string] + $version, + [Parameter(Mandatory=$true)] + [int] + $buildNumber + ) + + $uenv = Get-UmbracoBuildEnv + + Write-Host "Version is currently set to $version" + + $versionComment = $buildNumber + $versionComment = $versionComment.ToString().PadLeft(4,"0") + $umbracoVersion = "$($version.Trim())-alpha$versionComment" + + Write-Host "Setting Umbraco Version to $umbracoVersion" + Set-UmbracoVersion $umbracoVersion +} \ No newline at end of file diff --git a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 index 32803ae8f0..e12a8a09e9 100644 --- a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 +++ b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 @@ -19,6 +19,7 @@ . "$PSScriptRoot\Get-UmbracoBuildEnv.ps1" . "$PSScriptRoot\Set-UmbracoVersion.ps1" +. "$PSScriptRoot\Set-UmbracoContinuousVersion.ps1" . "$PSScriptRoot\Get-UmbracoVersion.ps1" . "$PSScriptRoot\Verify-NuGet.ps1" @@ -595,6 +596,7 @@ function Build-Umbraco # Export-ModuleMember -function Get-UmbracoBuildEnv Export-ModuleMember -function Set-UmbracoVersion +Export-ModuleMember -function Set-UmbracoContinuousVersion Export-ModuleMember -function Get-UmbracoVersion Export-ModuleMember -function Build-Umbraco Export-ModuleMember -function Build-UmbracoDocs From fb2f9cea64b7bfdafceb54af19a64813f462f6b1 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 12 Sep 2017 11:03:56 +0200 Subject: [PATCH 3/5] Make VSTS responsible for padding the build number --- .../Set-UmbracoContinuousVersion.ps1 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 b/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 index f080940104..8996777292 100644 --- a/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 +++ b/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 @@ -7,7 +7,8 @@ # eg 1.2.3, 1.2.3-alpha, 1.2.3-alpha+456 # # -BuildNumber -# where is an integer coming from the build server +# where is a string coming from the build server +# eg 34, 126, 1 # function Set-UmbracoContinuousVersion { @@ -16,18 +17,14 @@ function Set-UmbracoContinuousVersion [string] $version, [Parameter(Mandatory=$true)] - [int] + [string] $buildNumber ) - $uenv = Get-UmbracoBuildEnv - Write-Host "Version is currently set to $version" - - $versionComment = $buildNumber - $versionComment = $versionComment.ToString().PadLeft(4,"0") - $umbracoVersion = "$($version.Trim())-alpha$versionComment" - + + $umbracoVersion = "$($version.Trim())-alpha$($buildNumber)" Write-Host "Setting Umbraco Version to $umbracoVersion" + Set-UmbracoVersion $umbracoVersion } \ No newline at end of file From 4cb7b29f603c18134702e21ea579036e9b16b97a Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 12 Sep 2017 11:20:46 +0200 Subject: [PATCH 4/5] Try to make build server do the npm/gulp tasks on it's own --- build/Modules/Umbraco.Build/Umbraco.Build.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 index e12a8a09e9..15f84c06ca 100644 --- a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 +++ b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 @@ -520,7 +520,7 @@ function Build-Umbraco if ($target -eq "pre-build") { Prepare-Build $uenv - Compile-Belle $uenv $version + #Compile-Belle $uenv $version # set environment variables $env:UMBRACO_VERSION=$version.Semver.ToString() From d179792cc3ad925a5500da2173e03a9a19fc9073 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 12 Sep 2017 11:39:34 +0200 Subject: [PATCH 5/5] perfs - fix IsPublishable silly bug --- src/Umbraco.Core/Services/ContentService.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 913a83c1cd..ce4cdac39a 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -903,10 +903,23 @@ namespace Umbraco.Core.Services /// True if the Content can be published, otherwise False public bool IsPublishable(IContent content) { - // get ids from path - // skip the first one that has to be -1 - and we don't care - // skip the last one that has to be "this" - and it's ok to stop at the parent - var ids = content.Path.Split(',').Skip(1).SkipLast().Select(int.Parse).ToArray(); + int[] ids; + if (content.HasIdentity) + { + // get ids from path (we have identity) + // skip the first one that has to be -1 - and we don't care + // skip the last one that has to be "this" - and it's ok to stop at the parent + ids = content.Path.Split(',').Skip(1).SkipLast().Select(int.Parse).ToArray(); + } + else + { + // no path yet (no identity), have to move up to parent + // skip the first one that has to be -1 - and we don't care + // don't skip the last one that is "parent" + var parent = GetById(content.ParentId); + if (parent == null) return false; + ids = parent.Path.Split(',').Skip(1).Select(int.Parse).ToArray(); + } if (ids.Length == 0) return false;