Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save katzueno/8540e36f22d1981d1cff4b87f9929cbc to your computer and use it in GitHub Desktop.
Save katzueno/8540e36f22d1981d1cff4b87f9929cbc to your computer and use it in GitHub Desktop.
A job to deletes empty "Compare Versions" alert to clear Workflow concrete5
<?php
namespace Application\Job;
use Job as AbstractJob;
use Concrete\Core\Workflow\Progress\PageProgress;
use Concrete\Core\Workflow\EmptyWorkflow;
class ClearEmptyWorkflowProgress extends AbstractJob
{
public function getJobName()
{
return t("Clear Empty Workflow Progress");
}
public function getJobDescription()
{
return t("Deletes empty \"Compare Versions\" alert.");
}
public function run()
{
// retrieve all pending page workflow progresses
$list = PageProgress::getPendingWorkflowProgressList();
$r = $list->get();
foreach ($r as $w) {
$wp = $w->getWorkflowProgressObject();
$wo = $wp->getWorkflowObject();
if ($wo instanceof EmptyWorkflow) {
$wp->delete();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment