fix+cleanup publishing with variants

This commit is contained in:
Stephan
2018-11-08 16:33:19 +01:00
parent 4b23090e97
commit 5381eec6a4
22 changed files with 309 additions and 265 deletions

View File

@@ -3,6 +3,7 @@ using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Web.Http;
using AutoMapper;
using Umbraco.Core;
@@ -28,10 +29,14 @@ namespace Umbraco.Web.Editors
[HttpGet]
public IDictionary<string, string> GetAllCultures()
{
return
CultureInfo.GetCultures(CultureTypes.AllCultures)
.Where(x => !x.Name.IsNullOrWhiteSpace())
.OrderBy(x => x.DisplayName).ToDictionary(x => x.Name, x => x.DisplayName);
// get cultures - new-ing instances to get proper display name,
// in the current culture, and not the cached one
// (see notes in Language class about culture info names)
return CultureInfo.GetCultures(CultureTypes.AllCultures)
.Where(x => !x.Name.IsNullOrWhiteSpace())
.Select(x => new CultureInfo(x.Name)) // important!
.OrderBy(x => x.DisplayName)
.ToDictionary(x => x.Name, x => x.DisplayName);
}
/// <summary>

View File

@@ -1,7 +1,6 @@
using System;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Publishing;
using Umbraco.Core.Services;
using Umbraco.Core.Sync;
@@ -12,16 +11,14 @@ namespace Umbraco.Web.Scheduling
private readonly IRuntimeState _runtime;
private readonly IContentService _contentService;
private readonly ILogger _logger;
private readonly IUserService _userService;
public ScheduledPublishing(IBackgroundTaskRunner<RecurringTaskBase> runner, int delayMilliseconds, int periodMilliseconds,
IRuntimeState runtime, IContentService contentService, ILogger logger, IUserService userService)
IRuntimeState runtime, IContentService contentService, ILogger logger)
: base(runner, delayMilliseconds, periodMilliseconds)
{
_runtime = runtime;
_contentService = contentService;
_logger = logger;
_userService = userService;
}
public override bool PerformRun()
@@ -58,9 +55,8 @@ namespace Umbraco.Web.Scheduling
// run
// fixme context & events during scheduled publishing?
// in v7 we create an UmbracoContext and an HttpContext, and cache instructions
// are batched, and we have to explicitely flush them, how is it going to work here?
var publisher = new ScheduledPublisher(_contentService, _logger, _userService);
var count = publisher.CheckPendingAndProcess();
// are batched, and we have to explicitly flush them, how is it going to work here?
_contentService.PerformScheduledPublish(DateTime.Now);
}
catch (Exception ex)
{

View File

@@ -26,7 +26,6 @@ namespace Umbraco.Web.Scheduling
{
private IRuntimeState _runtime;
private IContentService _contentService;
private IUserService _userService;
private IAuditService _auditService;
private ILogger _logger;
private ProfilingLogger _proflog;
@@ -45,13 +44,12 @@ namespace Umbraco.Web.Scheduling
private IBackgroundTask[] _tasks;
public void Initialize(IRuntimeState runtime,
IContentService contentService, IAuditService auditService, IUserService userService,
IContentService contentService, IAuditService auditService,
HealthCheckCollection healthChecks, HealthCheckNotificationMethodCollection notifications,
IScopeProvider scopeProvider, ILogger logger, ProfilingLogger proflog)
{
_runtime = runtime;
_contentService = contentService;
_userService = userService;
_auditService = auditService;
_scopeProvider = scopeProvider;
_logger = logger;
@@ -118,7 +116,7 @@ namespace Umbraco.Web.Scheduling
{
// scheduled publishing/unpublishing
// install on all, will only run on non-replica servers
var task = new ScheduledPublishing(_publishingRunner, 60000, 60000, _runtime, _contentService, _logger, _userService);
var task = new ScheduledPublishing(_publishingRunner, 60000, 60000, _runtime, _contentService, _logger);
_publishingRunner.TryAdd(task);
return task;
}