Files
Umbraco-CMS/src/Umbraco.Web.Common/AspNetCore/AspNetCoreBackOfficeInfo.cs
Ronald Barendse 780184e553 Remove UmbracoPath setting (#16037)
* Use require modifier instead of setting null-suppressed default values

* Only remove read-only properties when IgnoreReadOnlyProperties is set

* Obsolete UmbracoPath property and remove work-around for obsolete setter

* Remove UmbracoPath setting and use constant instead

* Remove usage of GetBackOfficePath

* Add IHostingEnvironment.GetBackOfficePath() extension method

* Add Constants.System.UmbracoPathSegment constant

* Update Constants.System XML docs

* Replace StringBuilder with string interpolation

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>

* Fix syntax error

* Removed uses of obsoletes.

* Further obsolete messages.

* Cleaned up usings.

* Update src/Umbraco.Infrastructure/Install/FilePermissionHelper.cs

Co-authored-by: Ronald Barendse <ronald@barend.se>

---------

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-03-03 07:38:30 +01:00

42 lines
1.4 KiB
C#

using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Hosting;
using Umbraco.Cms.Core.Routing;
namespace Umbraco.Cms.Web.Common.AspNetCore;
public class AspNetCoreBackOfficeInfo : IBackOfficeInfo
{
private readonly IHostingEnvironment _hostingEnvironment;
private string? _getAbsoluteUrl;
public AspNetCoreBackOfficeInfo(IHostingEnvironment hostingEnviroment)
=> _hostingEnvironment = hostingEnviroment;
[Obsolete("The globalSettings parameter is not required anymore, use the other constructor instead. Scheduled for removal in Umbraco 17.")]
public AspNetCoreBackOfficeInfo(IOptionsMonitor<GlobalSettings> globalSettings, IHostingEnvironment hostingEnviroment)
: this(hostingEnviroment)
{ }
public string GetAbsoluteUrl
{
get
{
if (_getAbsoluteUrl is null)
{
if (_hostingEnvironment.ApplicationMainUrl is null)
{
return string.Empty;
}
_getAbsoluteUrl = WebPath.Combine(
_hostingEnvironment.ApplicationMainUrl.ToString(),
Core.Constants.System.DefaultUmbracoPath.TrimStart(Core.Constants.CharArrays.TildeForwardSlash));
}
return _getAbsoluteUrl;
}
}
}