diff --git a/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 b/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 new file mode 100644 index 0000000000..8996777292 --- /dev/null +++ b/build/Modules/Umbraco.Build/Set-UmbracoContinuousVersion.ps1 @@ -0,0 +1,30 @@ +# +# 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 a string coming from the build server +# eg 34, 126, 1 +# +function Set-UmbracoContinuousVersion +{ + param ( + [Parameter(Mandatory=$true)] + [string] + $version, + [Parameter(Mandatory=$true)] + [string] + $buildNumber + ) + + Write-Host "Version is currently set to $version" + + $umbracoVersion = "$($version.Trim())-alpha$($buildNumber)" + 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..15f84c06ca 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" @@ -519,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() @@ -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 diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index b512e7e337..1c9d1b48a6 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -961,10 +961,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; 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>();