Merge branch 'v9/9.4' into v9/dev

# Conflicts:
#	src/Umbraco.Core/Security/LegacyPasswordSecurity.cs
#	src/Umbraco.Web.UI.Client/src/common/directives/components/references/umbtrackedreferences.component.js
#	src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
#	tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Security/UmbracoPasswordHasherTests.cs
This commit is contained in:
Mole
2022-03-23 09:44:53 +01:00
17 changed files with 57 additions and 22 deletions

View File

@@ -1,3 +1,4 @@
using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;

View File

@@ -32,7 +32,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
IContentVersionService service,
IMainDom mainDom,
IServerRoleAccessor serverRoleAccessor)
: base(TimeSpan.FromHours(1), TimeSpan.FromMinutes(3))
: base(logger, TimeSpan.FromHours(1), TimeSpan.FromMinutes(3))
{
_runtimeState = runtimeState;
_logger = logger;

View File

@@ -61,6 +61,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
IProfilingLogger profilingLogger,
ICronTabParser cronTabParser)
: base(
logger,
healthChecksSettings.Value.Notification.Period,
healthChecksSettings.Value.GetNotificationDelay(cronTabParser, DateTime.Now, DefaultDelay))
{

View File

@@ -49,7 +49,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
IProfilingLogger profilingLogger,
IServerRoleAccessor serverRegistrar,
IHttpClientFactory httpClientFactory)
: base(TimeSpan.FromMinutes(5), DefaultDelay)
: base(logger, TimeSpan.FromMinutes(5), DefaultDelay)
{
_hostingEnvironment = hostingEnvironment;
_mainDom = mainDom;

View File

@@ -48,7 +48,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
IScopeProvider scopeProvider,
ILogger<LogScrubber> logger,
IProfilingLogger profilingLogger)
: base(TimeSpan.FromHours(4), DefaultDelay)
: base(logger, TimeSpan.FromHours(4), DefaultDelay)
{
_mainDom = mainDom;
_serverRegistrar = serverRegistrar;

View File

@@ -4,7 +4,10 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Infrastructure.HostedServices
{
@@ -21,6 +24,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
/// </summary>
protected static readonly TimeSpan DefaultDelay = TimeSpan.FromMinutes(3);
private readonly ILogger _logger;
private TimeSpan _period;
private readonly TimeSpan _delay;
private Timer _timer;
@@ -29,18 +33,33 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
/// <summary>
/// Initializes a new instance of the <see cref="RecurringHostedServiceBase"/> class.
/// </summary>
/// <param name="period">Timepsan representing how often the task should recur.</param>
/// <param name="delay">Timespan represeting the initial delay after application start-up before the first run of the task occurs.</param>
/// <param name="logger">Logger.</param>
/// <param name="period">Timespan representing how often the task should recur.</param>
/// <param name="delay">Timespan representing the initial delay after application start-up before the first run of the task occurs.</param>
protected RecurringHostedServiceBase(ILogger logger, TimeSpan period, TimeSpan delay)
{
_logger = logger;
_period = period;
_delay = delay;
}
// Scheduled for removal in V11
[Obsolete("Please use constructor that takes an ILogger instead")]
protected RecurringHostedServiceBase(TimeSpan period, TimeSpan delay)
{
_period = period;
_delay = delay;
_logger = StaticServiceProvider.Instance.GetRequiredService<ILoggerFactory>().CreateLogger(GetType());
}
/// <inheritdoc/>
public Task StartAsync(CancellationToken cancellationToken)
{
_timer = new Timer(ExecuteAsync, null, (int)_delay.TotalMilliseconds, (int)_period.TotalMilliseconds);
using (!ExecutionContext.IsFlowSuppressed() ? (IDisposable)ExecutionContext.SuppressFlow() : null)
{
_timer = new Timer(ExecuteAsync, null, (int)_delay.TotalMilliseconds, (int)_period.TotalMilliseconds);
}
return Task.CompletedTask;
}
@@ -61,6 +80,10 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
// Hat-tip: https://stackoverflow.com/a/14207615/489433
await PerformExecuteAsync(state);
}
catch (Exception ex)
{
_logger.LogError(ex, "Unhandled exception in recurring hosted service.");
}
finally
{
// Resume now that the task is complete - Note we use period in both because we don't want to execute again after the delay.

View File

@@ -23,7 +23,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
public ReportSiteTask(
ILogger<ReportSiteTask> logger,
ITelemetryService telemetryService)
: base(TimeSpan.FromDays(1), TimeSpan.FromMinutes(1))
: base(logger, TimeSpan.FromDays(1), TimeSpan.FromMinutes(1))
{
_logger = logger;
_telemetryService = telemetryService;

View File

@@ -71,7 +71,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
ILogger<ScheduledPublishing> logger,
IServerMessenger serverMessenger,
IScopeProvider scopeProvider)
: base(TimeSpan.FromMinutes(1), DefaultDelay)
: base(logger, TimeSpan.FromMinutes(1), DefaultDelay)
{
_runtimeState = runtimeState;
_mainDom = mainDom;

View File

@@ -30,7 +30,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices.ServerRegistration
/// <param name="logger">The typed logger.</param>
/// <param name="globalSettings">The configuration for global settings.</param>
public InstructionProcessTask(IRuntimeState runtimeState, IServerMessenger messenger, ILogger<InstructionProcessTask> logger, IOptions<GlobalSettings> globalSettings)
: base(globalSettings.Value.DatabaseServerMessenger.TimeBetweenSyncOperations, TimeSpan.FromMinutes(1))
: base(logger, globalSettings.Value.DatabaseServerMessenger.TimeBetweenSyncOperations, TimeSpan.FromMinutes(1))
{
_runtimeState = runtimeState;
_messenger = messenger;

View File

@@ -44,7 +44,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices.ServerRegistration
ILogger<TouchServerTask> logger,
IOptions<GlobalSettings> globalSettings,
IServerRoleAccessor serverRoleAccessor)
: base(globalSettings.Value.DatabaseServerRegistrar.WaitTimeBetweenCalls, TimeSpan.FromSeconds(15))
: base(logger, globalSettings.Value.DatabaseServerRegistrar.WaitTimeBetweenCalls, TimeSpan.FromSeconds(15))
{
_runtimeState = runtimeState;
_serverRegistrationService = serverRegistrationService ?? throw new ArgumentNullException(nameof(serverRegistrationService));

View File

@@ -33,7 +33,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices
/// <param name="mainDom">Representation of the main application domain.</param>
/// <param name="logger">The typed logger.</param>
public TempFileCleanup(IIOHelper ioHelper, IMainDom mainDom, ILogger<TempFileCleanup> logger)
: base(TimeSpan.FromMinutes(60), DefaultDelay)
: base(logger, TimeSpan.FromMinutes(60), DefaultDelay)
{
_ioHelper = ioHelper;
_mainDom = mainDom;

View File

@@ -247,6 +247,13 @@ namespace Umbraco.Cms.Core.Services.Implement
/// </summary>
private bool TryDeserializeInstructions(CacheInstruction instruction, out JArray jsonInstructions)
{
if (instruction.Instructions is null)
{
_logger.LogError("Failed to deserialize instructions ({DtoId}: 'null').", instruction.Id);
jsonInstructions = null;
return false;
}
try
{
jsonInstructions = JsonConvert.DeserializeObject<JArray>(instruction.Instructions);

View File

@@ -17,16 +17,15 @@
function onInit() {
vm.referencesTitle = this.hideNoneDependencies ? "The following items depend on this" : "Referenced by the following items";
vm.referencedDescendantsTitle = this.hideNoneDependencies ? "The following descending items have dependencies" : "The following descending items are referenced";
vm.referencedDescendantsTitle = this.hideNoneDependencies ? "The following descending items have dependencies" : "The following descendant items have dependencies";
localizationService.localize(this.hideNoneDependencies ? "references_labelDependsOnThis" : "references_labelUsedByItems").then(function (value) {
vm.referencesTitle = value;
});
localizationService.localize(this.hideNoneDependencies ? "references_labelDependentDescendants" : "references_labelUsedDescendants").then(function (value) {
vm.referencedDescendantsTitle = value;
});
vm.descendantsOptions = {};
vm.descendantsOptions.filterMustBeIsDependency = this.hideNoneDependencies;
vm.hasReferencesInDescendants = false;

View File

@@ -128,13 +128,13 @@
<!-- Links -->
<div class="umb-help-section" data-element="help-links" ng-if="vm.hasAccessToSettings">
<a data-element="help-link-umbraco-tv" class="umb-help-badge" href="https://umbraco.tv?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv" target="_blank" rel="noopener">
<a data-element="help-link-umbraco-tv" class="umb-help-badge" href="https://umbra.co/ulb" target="_blank" rel="noopener">
<umb-icon icon="icon-tv-old" class="umb-help-badge__icon"></umb-icon>
<div class="umb-help-badge__title">
<localize key="help_umbracoTv">Visit umbraco.tv</localize>
<localize key="help_umbracoLearningBase">Watch our free tutorial videos</localize>
</div>
<small>
<localize key="help_theBestUmbracoVideoTutorials">The best Umbraco video tutorials</localize>
<localize key="help_umbracoLearningBaseDescription">on the Umbraco Learning Base</localize>
</small>
</a>

View File

@@ -17,7 +17,7 @@
<localize key="settingsDashboard_bulletPointTwo">Ask a question in the <a class="btn-link -underline" href="https://our.umbraco.com/forum" target="_blank" rel="noopener">Community Forum</a></localize>
</li>
<li>
<localize key="settingsDashboard_bulletPointTutorials">Watch our free <a class="btn-link -underline" href="https://www.youtube.com/c/UmbracoLearningBase" target="_blank" rel="noopener">tutorial videos on the Umbraco Learning Base</a></localize>
<localize key="settingsDashboard_bulletPointTutorials">Watch our free <a class="btn-link -underline" href="https://umbra.co/ulb" target="_blank" rel="noopener">tutorial videos on the Umbraco Learning Base</a></localize>
</li>
<li>
<localize key="settingsDashboard_bulletPointFour">Find out about our <a class="btn-link -underline" href="https://umbraco.com/products/" target="_blank" rel="noopener">productivity boosting tools and commercial support</a></localize>

View File

@@ -1471,6 +1471,8 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="theBestUmbracoVideoTutorials">The best Umbraco video tutorials</key>
<key alias="umbracoForum">Visit our.umbraco.com</key>
<key alias="umbracoTv">Visit umbraco.tv</key>
<key alias="umbracoLearningBase">Watch our free tutorial videos</key>
<key alias="umbracoLearningBaseDescription">on the Umbraco Learning Base</key>
</area>
<area alias="settings">
<key alias="defaulttemplate">Default template</key>
@@ -2637,7 +2639,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
</key>
<key alias="bulletPointTutorials">
<![CDATA[
Watch our free <a class="btn-link -underline" href="https://www.youtube.com/c/UmbracoLearningBase" target="_blank" rel="noopener">tutorial videos on the Umbraco Learning Base</a>
Watch our free <a class="btn-link -underline" href="https://umbra.co/ulb" target="_blank" rel="noopener">tutorial videos on the Umbraco Learning Base</a>
]]>
</key>
<key alias="bulletPointFour">

View File

@@ -1494,6 +1494,8 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="theBestUmbracoVideoTutorials">The best Umbraco video tutorials</key>
<key alias="umbracoForum">Visit our.umbraco.com</key>
<key alias="umbracoTv">Visit umbraco.tv</key>
<key alias="umbracoLearningBase">Watch our free tutorial videos</key>
<key alias="umbracoLearningBaseDescription">on the Umbraco Learning Base</key>
</area>
<area alias="settings">
<key alias="defaulttemplate">Default template</key>
@@ -2561,7 +2563,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="labelUsedByItems">Referenced by the following items</key>
<key alias="labelDependsOnThis">The following items depend on this</key>
<key alias="labelUsedItems">The following items are referenced</key>
<key alias="labelUsedDescendants">The following descending items are referenced</key>
<key alias="labelUsedDescendants">The following descendant items have dependencies</key>
<key alias="labelDependentDescendants">The following descending items have dependencies</key>
<key alias="deleteWarning">This item or its descendants is being referenced. Deletion can lead to broken links on your website.</key>
<key alias="unpublishWarning">This item or its descendants is being referenced. Unpublishing can lead to broken links on your website. Please take the appropriate actions.</key>
@@ -2722,7 +2724,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
</key>
<key alias="bulletPointTutorials">
<![CDATA[
Watch our free <a class="btn-link -underline" href="https://www.youtube.com/c/UmbracoLearningBase" target="_blank" rel="noopener">tutorial videos on the Umbraco Learning Base</a>
Watch our free <a class="btn-link -underline" href="https://umbra.co/ulb" target="_blank" rel="noopener">tutorial videos on the Umbraco Learning Base</a>
]]>
</key>
<key alias="bulletPointFour">