Skip to content

Commit

Permalink
Merge branch '6.0' into 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 17, 2023
2 parents e507c51 + 1d59b00 commit c131b3e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Extensions/WorkflowEmbargoExpiryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function updateCMSFields(FieldList $fields)
public function clearPublishJob()
{
$job = $this->owner->PublishJob();
if ($job && $job->exists()) {
if ($job && $job->exists() && !$job->JobFinished) {
$job->delete();
}
$this->owner->PublishJobID = 0;
Expand All @@ -189,7 +189,7 @@ public function clearUnPublishJob()
{
// Cancel any in-progress unpublish job
$job = $this->owner->UnPublishJob();
if ($job && $job->exists()) {
if ($job && $job->exists() && !$job->JobFinished) {
$job->delete();
}
$this->owner->UnPublishJobID = 0;
Expand Down Expand Up @@ -293,6 +293,10 @@ public function onBeforeWrite()
if (!$this->owner->ID) {
return;
}

if ($this->owner->hasMethod('isPublishJobRunning') && $this->owner->isPublishJobRunning()) {
return;
}

// Check requested dates of publish / unpublish, and whether the page should have already been unpublished
$now = DBDatetime::now()->getTimestamp();
Expand Down

0 comments on commit c131b3e

Please sign in to comment.