Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active March 14, 2023 19:58
Show Gist options
  • Save hissy/5ea2147516a90710919d to your computer and use it in GitHub Desktop.
Save hissy/5ea2147516a90710919d to your computer and use it in GitHub Desktop.
[concrete5] A job to deletes empty "Compare Versions" alerts.
<?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();
}
}
}
}
@jcarpenter11986
Copy link

More thanks coming your way! @hissy

@hissy
Copy link
Author

hissy commented Mar 14, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment