https://dev.azure.com/umbraco/D-Team%20Tracker/_workitems/edit/6587 - Moved controllers: HealthCheckController + All localization files + fixed issues with MapPath from wwwroot to content root

This commit is contained in:
Bjarke Berg
2020-05-25 14:50:51 +02:00
parent ee3615e36d
commit 2c2d70c500
37 changed files with 4290 additions and 4311 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
@@ -10,10 +11,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
public abstract class AbstractConfigCheck : HealthCheck
{
private readonly IHostingEnvironment _hostingEnvironment;
private readonly ConfigurationService _configurationService;
protected ILocalizedTextService TextService { get; }
protected IIOHelper IOHelper { get; }
protected ILogger Logger { get; }
/// <summary>
@@ -54,10 +55,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
get { return false; }
}
protected AbstractConfigCheck(ILocalizedTextService textService, IIOHelper ioHelper, ILogger logger)
protected AbstractConfigCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILogger logger)
{
_hostingEnvironment = hostingEnvironment;
TextService = textService;
IOHelper = ioHelper;
Logger = logger;
_configurationService = new ConfigurationService(AbsoluteFilePath, XPath, textService, logger);
}
@@ -70,7 +71,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
/// <summary>
/// Gets the absolute file path.
/// </summary>
private string AbsoluteFilePath => IOHelper.MapPath(FilePath);
private string AbsoluteFilePath => _hostingEnvironment.MapPathContentRoot(FilePath);
/// <summary>
/// Gets the message for when the check has succeeded.

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
@@ -10,8 +11,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
Group = "Live Environment")]
public class CompilationDebugCheck : AbstractConfigCheck
{
public CompilationDebugCheck(ILocalizedTextService textService, IIOHelper ioHelper, ILogger logger)
: base(textService, ioHelper, logger)
public CompilationDebugCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILogger logger)
: base(textService, hostingEnvironment, logger)
{ }
public override string FilePath => "~/Web.config";

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
@@ -11,8 +12,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
Group = "Live Environment")]
public class CustomErrorsCheck : AbstractConfigCheck
{
public CustomErrorsCheck(ILocalizedTextService textService, IIOHelper ioHelper, ILogger logger)
: base(textService, ioHelper, logger)
public CustomErrorsCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILogger logger)
: base(textService, hostingEnvironment, logger)
{ }
public override string FilePath => "~/Web.config";

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
@@ -11,8 +12,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
Group = "Configuration")]
public class MacroErrorsCheck : AbstractConfigCheck
{
public MacroErrorsCheck(ILocalizedTextService textService, IIOHelper ioHelper, ILogger logger)
: base(textService, ioHelper, logger)
public MacroErrorsCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILogger logger)
: base(textService, hostingEnvironment, logger)
{ }
public override string FilePath => "~/Config/umbracoSettings.config";

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
@@ -12,8 +13,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
private const string DefaultFromEmail = "your@email.here";
public NotificationEmailCheck(ILocalizedTextService textService, IIOHelper ioHelper, ILogger logger)
: base(textService, ioHelper, logger)
public NotificationEmailCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILogger logger)
: base(textService, hostingEnvironment, logger)
{ }
public override string FilePath => "~/Config/umbracoSettings.config";

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
@@ -11,8 +12,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
public class TraceCheck : AbstractConfigCheck
{
public TraceCheck(ILocalizedTextService textService, IIOHelper ioHelper, ILogger logger)
: base(textService, ioHelper, logger)
public TraceCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILogger logger)
: base(textService, hostingEnvironment, logger)
{ }
public override string FilePath => "~/Web.config";

View File

@@ -15,9 +15,9 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
private readonly Version _iisVersion;
public TrySkipIisCustomErrorsCheck(ILocalizedTextService textService, IIOHelper ioHelper, ILogger logger,
public TrySkipIisCustomErrorsCheck(ILocalizedTextService textService, ILogger logger,
IHostingEnvironment hostingEnvironment)
: base(textService, ioHelper, logger)
: base(textService, hostingEnvironment, logger)
{
_iisVersion = hostingEnvironment.IISVersion;
}

View File

@@ -2,8 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Serilog.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;

View File

@@ -4,6 +4,7 @@ using System.Linq;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Packaging;
@@ -97,11 +98,11 @@ namespace Umbraco.Core.Composing.CompositionExtensions
private static LocalizedTextServiceFileSources SourcesFactory(IFactory container)
{
var ioHelper = container.GetInstance<IIOHelper>();
var hostingEnvironment = container.GetInstance<IHostingEnvironment>();
var globalSettings = container.GetInstance<IGlobalSettings>();
var mainLangFolder = new DirectoryInfo(ioHelper.MapPath(globalSettings.UmbracoPath + "/config/lang/"));
var appPlugins = new DirectoryInfo(ioHelper.MapPath(Constants.SystemDirectories.AppPlugins));
var configLangFolder = new DirectoryInfo(ioHelper.MapPath(Constants.SystemDirectories.Config + "/lang/"));
var mainLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(globalSettings.UmbracoPath + "/config/lang/"));
var appPlugins = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.AppPlugins));
var configLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Config + "/lang/"));
var pluginLangFolders = appPlugins.Exists == false
? Enumerable.Empty<LocalizedTextServiceSupplementaryFileSource>()

View File

@@ -49,6 +49,16 @@ namespace Umbraco.Core.Services.Implement
_logger = logger;
_cache = appCaches.RuntimeCache;
if (fileSourceFolder.Exists == false)
{
Current.Logger.Warn<LocalizedTextServiceFileSources>("The folder does not exist: {FileSourceFolder}, therefore no sources will be discovered", fileSourceFolder.FullName);
}
else
{
_fileSourceFolder = fileSourceFolder;
_supplementFileSources = supplementFileSources;
}
//Create the lazy source for the _xmlSources
_xmlSources = new Lazy<Dictionary<CultureInfo, Lazy<XDocument>>>(() =>
{
@@ -124,15 +134,7 @@ namespace Umbraco.Core.Services.Implement
return result;
});
if (fileSourceFolder.Exists == false)
{
Current.Logger.Warn<LocalizedTextServiceFileSources>("The folder does not exist: {FileSourceFolder}, therefore no sources will be discovered", fileSourceFolder.FullName);
}
else
{
_fileSourceFolder = fileSourceFolder;
_supplementFileSources = supplementFileSources;
}
}
/// <summary>

View File

@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Umbraco.Core;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Core.Logging;
using Umbraco.Web.Editors;
using Umbraco.Web.WebApi.Filters;
using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Web.BackOffice.Filters;
namespace Umbraco.Web.HealthCheck
{

View File

@@ -13,6 +13,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Umbraco" />
<Folder Include="Views\" />
<Folder Include="wwwroot\Media" />
<Folder Include="wwwroot\Umbraco\views\install" />
@@ -32,6 +33,10 @@
<DependentUpon>tinyMceConfig.config</DependentUpon>
<SubType>Designer</SubType>
</None>
<None Include="Config\umbracoSettings.Release.config">
<DependentUpon>umbracoSettings.config</DependentUpon>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
@@ -52,6 +57,9 @@
<Content Update="Config\tinyMceConfig.config">
<SubType>Designer</SubType>
</Content>
<Content Update="Config\umbracoSettings.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>

View File

@@ -161,9 +161,6 @@
<Content Include="Config\Lang\sv-SE.user.xml" />
<Content Include="Config\Lang\zh-CN.user.xml" />
<None Include="Config\splashes\NoNodes.cshtml" />
<Content Include="Umbraco\Config\Lang\cs.xml" />
<Content Include="Umbraco\Config\Lang\tr.xml" />
<Content Include="Umbraco\Config\Lang\zh_tw.xml" />
<Content Include="Umbraco\Install\Views\Web.config" />
<None Include="Config\ClientDependency.Release.config">
<DependentUpon>ClientDependency.config</DependentUpon>
@@ -196,10 +193,6 @@
<SubType>Designer</SubType>
</None>
<Content Include="Config\logviewer.searches.config.js" />
<None Include="Config\umbracoSettings.Release.config">
<DependentUpon>umbracoSettings.config</DependentUpon>
<SubType>Designer</SubType>
</None>
<Content Include="Umbraco\Install\Views\Index.cshtml" />
<Content Include="Media\Web.config" />
<Content Include="Properties\Settings.settings">
@@ -207,29 +200,6 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</Content>
<Content Include="Global.asax" />
<Content Include="Umbraco\Config\Lang\en_us.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="Umbraco\Config\Lang\he.xml" />
<Content Include="Umbraco\Config\Lang\ja.xml" />
<Content Include="Umbraco\Config\Lang\pl.xml" />
<Content Include="Umbraco\Config\Lang\pt.xml" />
<Content Include="Umbraco\Config\Lang\ru.xml" />
<Content Include="Umbraco\Config\Lang\zh.xml" />
<Content Include="Umbraco\Config\Lang\ko.xml" />
<Content Include="Umbraco\Config\Lang\da.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="Umbraco\Config\Lang\de.xml" />
<Content Include="Umbraco\Config\Lang\es.xml" />
<Content Include="Umbraco\Config\Lang\fr.xml" />
<Content Include="Umbraco\Config\Lang\it.xml" />
<Content Include="Umbraco\Config\Lang\nl.xml" />
<Content Include="Umbraco\Config\Lang\nb.xml" />
<Content Include="Umbraco\Config\Lang\sv.xml" />
<Content Include="Umbraco\Config\Lang\en.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="Umbraco\Js\UmbracoSpeechBubbleBackEnd.js" />
<Content Include="Config\ClientDependency.config">
<SubType>Designer</SubType>
@@ -289,9 +259,6 @@
<None Include="web.Template.config">
<SubType>Designer</SubType>
</None>
<Content Include="Config\umbracoSettings.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Config\BackOfficeTours\getting-started.json" />
</ItemGroup>
<!-- determine VSToolsPath -->

View File

@@ -282,10 +282,10 @@ namespace Umbraco.Web.Editors
// "examineMgmtBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<ExamineManagementController>(
// controller => controller.GetIndexerDetails())
// },
{
"healthCheckBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<HealthCheckController>(
controller => controller.GetAllHealthChecks())
},
// {
// "healthCheckBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<HealthCheckController>(
// controller => controller.GetAllHealthChecks())
// },
{
"templateQueryApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<TemplateQueryController>(
controller => controller.PostTemplateQuery(null))

View File

@@ -165,7 +165,6 @@
<Compile Include="Editors\TinyMceController.cs" />
<Compile Include="HttpContextAccessorExtensions.cs" />
<Compile Include="HttpContextExtensions.cs" />
<Compile Include="HealthCheck\Checks\Data\DatabaseIntegrityCheck.cs" />
<Compile Include="ImageCropperTemplateCoreExtensions.cs" />
<Compile Include="Install\ChangesMonitor.cs" />
<Compile Include="Logging\OwinLogger.cs" />
@@ -268,7 +267,6 @@
<Compile Include="Editors\BackOfficeNotificationsController.cs" />
<Compile Include="Editors\MemberGroupController.cs" />
<Compile Include="Composing\CompositionExtensions\Controllers.cs" />
<Compile Include="HealthCheck\HealthCheckController.cs" />
<Compile Include="HtmlHelperBackOfficeExtensions.cs" />
<Compile Include="Composing\ModuleInjector.cs" />
<Compile Include="Mvc\FilteredControllerFactoryCollection.cs" />