Checks if content has expired or is awaiting release before publishing

This commit is contained in:
Jordan Lane
2015-10-29 15:21:15 +00:00
parent 1e4c9c2505
commit c5cf1fa6b2

View File

@@ -2112,6 +2112,22 @@ namespace Umbraco.Core.Services
content.Name, content.Id));
return PublishStatusType.FailedPathNotPublished;
}
else if (content.ExpireDate.HasValue && content.ExpireDate.Value > DateTime.MinValue && DateTime.Now > content.ExpireDate.Value)
{
Logger.Info<ContentService>(
string.Format(
"Content '{0}' with Id '{1}' has expired and could not be published.",
content.Name, content.Id));
return PublishStatusType.FailedHasExpired;
}
else if (content.ReleaseDate.HasValue && content.ReleaseDate.Value > DateTime.MinValue && content.ReleaseDate.Value > DateTime.Now)
{
Logger.Info<ContentService>(
string.Format(
"Content '{0}' with Id '{1}' is awaiting release and could not be published.",
content.Name, content.Id));
return PublishStatusType.FailedAwaitingRelease;
}
return PublishStatusType.Success;
}