Skip to content

Commit

Permalink
Merge branch '5.9' into 5
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 17, 2023
2 parents 4573a82 + fd6e831 commit e2cd3ff
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 @@ -182,7 +182,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 @@ -195,7 +195,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 @@ -299,6 +299,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 e2cd3ff

Please sign in to comment.