Merge pull request #11002 from umbraco/v9/bugfix/fix_issues_when_changing_umbraco_path

Bugfix: Fixed issues when changing UmbracoPath in config
This commit is contained in:
Bjarke Berg
2021-09-08 19:08:11 +02:00
committed by GitHub
12 changed files with 37 additions and 17 deletions

View File

@@ -1,18 +1,26 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ContentFilesPath>$(MSBuildThisFileDirectory)..\content\**\*.*</ContentFilesPath>
<ContentFilesPath>$(MSBuildThisFileDirectory)..\content\umbraco\**\*.*</ContentFilesPath>
<ContentWwwrootFilesPath>$(MSBuildThisFileDirectory)..\content\wwwroot\umbraco\**\*.*</ContentWwwrootFilesPath>
<UmbracoWwwrootName Condition="'$(UmbracoWwwrootName)' == ''">umbraco</UmbracoWwwrootName>
</PropertyGroup>
<Target Name="CopyUmbracoAssets" BeforeTargets="Build">
<ItemGroup>
<ContentFiles Include="$(ContentFilesPath)" />
<ContentWwwrootFiles Include="$(ContentWwwrootFilesPath)" />
</ItemGroup>
<Message Text="Copying Umbraco content files: $(ContentFilesPath) - #@(ContentFiles->Count()) files" Importance="high" />
<Message Text="Copying Umbraco wwwroot content files: $(ContentWwwrootFilesPath) - #@(ContentWwwrootFiles->Count()) files" Importance="high" />
<Copy
SourceFiles="@(ContentFiles)"
DestinationFiles="@(ContentFiles->'$(MSBuildProjectDirectory)\%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(ContentFiles->'$(MSBuildProjectDirectory)\umbraco\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
<Copy
SourceFiles="@(ContentWwwrootFiles)"
DestinationFiles="@(ContentWwwrootFiles->'$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
</Target>
@@ -24,7 +32,7 @@
<UmbracoUmbracoBackOfficeMacrosDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoBackOffice\" />
<UmbracoUmbracoInstallDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoInstall\" />
<UmbracoUmbracoWebsiteMacrosDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoWebsite\" />
<WwwrootUmbracoPackageDir Include="$(MSBuildProjectDirectory)\wwwroot\umbraco\" />
<WwwrootUmbracoPackageDir Include="$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\" />
</ItemGroup>
<Message Text="Clear old umbraco data" Importance="high" />
<RemoveDir Directories="@(UmbracoConfigPackageDir)" />

View File

@@ -24,7 +24,7 @@
"version": {
"type": "parameter",
"datatype": "string",
"defaultValue": "9.0.0-rc002",
"defaultValue": "9.0.0-rc003",
"description": "The version of Umbraco to load using NuGet",
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},

View File

@@ -57,7 +57,7 @@
"version": {
"type": "parameter",
"datatype": "string",
"defaultValue": "9.0.0-rc002",
"defaultValue": "9.0.0-rc003",
"description": "The version of Umbraco to load using NuGet",
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<Version>9.0.0</Version>
<AssemblyVersion>9.0.0</AssemblyVersion>
<InformationalVersion>9.0.0-rc002</InformationalVersion>
<InformationalVersion>9.0.0-rc003</InformationalVersion>
<FileVersion>9.0.0</FileVersion>
<LangVersion Condition="'$(LangVersion)' == ''">9.0</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>

View File

@@ -103,7 +103,7 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
{
var hostingEnvironment = container.GetRequiredService<IHostingEnvironment>();
var globalSettings = container.GetRequiredService<IOptions<GlobalSettings>>().Value;
var mainLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(WebPath.Combine(globalSettings.UmbracoPath, "config", "lang")));
var mainLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(WebPath.Combine(Constants.SystemDirectories.Umbraco, "config", "lang")));
var appPlugins = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.AppPlugins));
var configLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(WebPath.Combine(Constants.SystemDirectories.Config, "lang")));

View File

@@ -50,7 +50,7 @@ namespace Umbraco.Cms.Infrastructure.Install
_packagesPermissionsDirs = new[]
{
hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Bin),
hostingEnvironment.MapPathContentRoot(_globalSettings.UmbracoPath),
hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Umbraco),
hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoPath),
hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Packages)
};

View File

@@ -624,7 +624,7 @@ namespace Umbraco.Cms.Core.Services.Implement
public IEnumerable<string> GetPartialViewSnippetNames(params string[] filterNames)
{
var snippetPath = _hostingEnvironment.MapPathContentRoot($"{_globalSettings.UmbracoPath}/PartialViewMacros/Templates/");
var snippetPath = _hostingEnvironment.MapPathContentRoot($"{Constants.SystemDirectories.Umbraco}/PartialViewMacros/Templates/");
var files = Directory.GetFiles(snippetPath, "*.cshtml")
.Select(Path.GetFileNameWithoutExtension)
.Except(filterNames, StringComparer.InvariantCultureIgnoreCase)
@@ -835,7 +835,7 @@ namespace Umbraco.Cms.Core.Services.Implement
fileName += ".cshtml";
}
var snippetPath = _hostingEnvironment.MapPathContentRoot($"{_globalSettings.UmbracoPath}/PartialViewMacros/Templates/{fileName}");
var snippetPath = _hostingEnvironment.MapPathContentRoot($"{Constants.SystemDirectories.Umbraco}/PartialViewMacros/Templates/{fileName}");
return System.IO.File.Exists(snippetPath)
? Attempt<string>.Succeed(snippetPath)
: Attempt<string>.Fail();

View File

@@ -118,7 +118,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
// force authentication to occur since this is not an authorized endpoint
var result = await this.AuthenticateBackOfficeAsync();
var viewPath = Path.Combine(_globalSettings.UmbracoPath , Constants.Web.Mvc.BackOfficeArea, nameof(Default) + ".cshtml")
var viewPath = Path.Combine(Constants.SystemDirectories.Umbraco, Constants.Web.Mvc.BackOfficeArea, nameof(Default) + ".cshtml")
.Replace("\\", "/"); // convert to forward slashes since it's a virtual path
return await RenderDefaultOrProcessExternalLoginAsync(
@@ -204,7 +204,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
// force authentication to occur since this is not an authorized endpoint
var result = await this.AuthenticateBackOfficeAsync();
var viewPath = Path.Combine(_globalSettings.UmbracoPath, Constants.Web.Mvc.BackOfficeArea, nameof(AuthorizeUpgrade) + ".cshtml");
var viewPath = Path.Combine(Constants.SystemDirectories.Umbraco, Constants.Web.Mvc.BackOfficeArea, nameof(AuthorizeUpgrade) + ".cshtml");
return await RenderDefaultOrProcessExternalLoginAsync(
result,

View File

@@ -93,7 +93,7 @@ namespace Umbraco.Cms.Web.BackOffice.Install
await _installHelper.SetInstallStatusAsync(false, "");
return View(Path.Combine(baseFolder , Cms.Core.Constants.Web.Mvc.InstallArea, nameof(Index) + ".cshtml"));
return View(Path.Combine(Constants.SystemDirectories.Umbraco.TrimStart("~") , Cms.Core.Constants.Web.Mvc.InstallArea, nameof(Index) + ".cshtml"));
}
/// <summary>

View File

@@ -347,7 +347,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder
}
public string PureLiveDirectoryAbsolute() => _hostingEnvironment.MapPathContentRoot("~/umbraco/Data/TEMP/PureLive");
public string PureLiveDirectoryAbsolute() => _hostingEnvironment.MapPathContentRoot(Core.Constants.SystemDirectories.TempData+"/InMemoryAuto");
// This is NOT thread safe but it is only called from within a lock

View File

@@ -1,9 +1,11 @@
@using Microsoft.Extensions.Options;
@using System.Globalization
@using Umbraco.Cms.Core
@using Umbraco.Cms.Core.Configuration
@using Umbraco.Cms.Core.Configuration.Models
@using Umbraco.Cms.Core.Hosting
@using Umbraco.Cms.Core.Logging
@using Umbraco.Cms.Core.Routing
@using Umbraco.Cms.Core.Services
@using Umbraco.Cms.Core.WebAssets
@using Umbraco.Cms.Infrastructure.WebAssets
@@ -119,7 +121,7 @@
}
</script>
<script src="lib/lazyload-js/LazyLoad.min.js"></script>
<script src="@WebPath.Combine(backOfficePath.TrimStart("~"), "/lib/lazyload-js/LazyLoad.min.js")"></script>
<script src="@Url.GetUrlWithCacheBust("Application", "BackOffice", null, hostingEnvironment, umbracoVersion, runtimeMinifier)"></script>
@if (isDebug)

View File

@@ -1,4 +1,14 @@
@model Umbraco.Cms.Web.Website.Models.NoNodesViewModel
@using Microsoft.Extensions.Options
@using Umbraco.Cms.Core.Configuration.Models
@using Umbraco.Cms.Core.Hosting
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@model Umbraco.Cms.Web.Website.Models.NoNodesViewModel
@inject IHostingEnvironment hostingEnvironment
@inject IOptions<GlobalSettings> globalSettings
@{
var backOfficePath = globalSettings.Value.GetBackOfficePath(hostingEnvironment);
}
<!doctype html>
<html class="no-js" lang="en">
<head>
@@ -8,7 +18,7 @@
<title>Umbraco: No Published Content</title>
<link rel="stylesheet" href="../../umbraco/assets/css/nonodes.style.min.css" />
<link rel="stylesheet" href="@WebPath.Combine(backOfficePath.TrimStart("~"), "/assets/css/nonodes.style.min.css")" />
</head>
<body>