From 876cb374ade52277c5e1ab406164d1963363a750 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 6 Apr 2017 16:45:00 +0200 Subject: [PATCH 1/2] Logs in DEBUG mode how much we're going to attempt to (un)publish and the result statuscodes of those attempts --- src/Umbraco.Core/Publishing/ScheduledPublisher.cs | 13 +++++++++++-- src/Umbraco.Core/Services/ContentService.cs | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Publishing/ScheduledPublisher.cs b/src/Umbraco.Core/Publishing/ScheduledPublisher.cs index 94df1b88f1..188cfebd3c 100644 --- a/src/Umbraco.Core/Publishing/ScheduledPublisher.cs +++ b/src/Umbraco.Core/Publishing/ScheduledPublisher.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Services; @@ -26,12 +27,16 @@ namespace Umbraco.Core.Publishing public int CheckPendingAndProcess() { var counter = 0; - foreach (var d in _contentService.GetContentForRelease()) + var contentForRelease = _contentService.GetContentForRelease().ToArray(); + if (contentForRelease.Any()) + LogHelper.Debug(string.Format("There's {0} item(s) of content to be published", contentForRelease.Length)); + foreach (var d in contentForRelease) { try { d.ReleaseDate = null; var result = _contentService.SaveAndPublishWithStatus(d, (int)d.GetWriterProfile().Id); + LogHelper.Debug(string.Format("Result of publish attempt: {0}", result.Result.StatusType)); if (result.Success == false) { if (result.Exception != null) @@ -54,7 +59,11 @@ namespace Umbraco.Core.Publishing throw; } } - foreach (var d in _contentService.GetContentForExpiration()) + + var contentForExpiration = _contentService.GetContentForExpiration().ToArray(); + if (contentForExpiration.Any()) + LogHelper.Debug(string.Format("There's {0} item(s) of content to be unpublished", contentForExpiration.Length)); + foreach (var d in contentForExpiration) { try { diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 1703768ed2..c00b226d3e 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -1124,7 +1124,9 @@ namespace Umbraco.Core.Services /// True if unpublishing succeeded, otherwise False public bool UnPublish(IContent content, int userId = 0) { - return ((IContentServiceOperations)this).UnPublish(content, userId).Success; + var attempt = ((IContentServiceOperations)this).UnPublish(content, userId); + LogHelper.Debug(string.Format("Result of unpublish attempt: {0}", attempt.Result.StatusType)); + return attempt.Success; } /// From 7c5a4d9d67d4876b92c7efe995a2031f8e800974 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 7 Apr 2017 15:08:32 +1000 Subject: [PATCH 2/2] Changes Any calls to use native length calls --- src/Umbraco.Core/Publishing/ScheduledPublisher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Publishing/ScheduledPublisher.cs b/src/Umbraco.Core/Publishing/ScheduledPublisher.cs index 188cfebd3c..b57bb1451a 100644 --- a/src/Umbraco.Core/Publishing/ScheduledPublisher.cs +++ b/src/Umbraco.Core/Publishing/ScheduledPublisher.cs @@ -28,7 +28,7 @@ namespace Umbraco.Core.Publishing { var counter = 0; var contentForRelease = _contentService.GetContentForRelease().ToArray(); - if (contentForRelease.Any()) + if (contentForRelease.Length > 0) LogHelper.Debug(string.Format("There's {0} item(s) of content to be published", contentForRelease.Length)); foreach (var d in contentForRelease) { @@ -61,7 +61,7 @@ namespace Umbraco.Core.Publishing } var contentForExpiration = _contentService.GetContentForExpiration().ToArray(); - if (contentForExpiration.Any()) + if (contentForExpiration.Length > 0) LogHelper.Debug(string.Format("There's {0} item(s) of content to be unpublished", contentForExpiration.Length)); foreach (var d in contentForExpiration) {