Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active June 12, 2020 05:18
Show Gist options
  • Save hissy/ea2bfd97641d0dbc3b7485cb66d80e15 to your computer and use it in GitHub Desktop.
Save hissy/ea2bfd97641d0dbc3b7485cb66d80e15 to your computer and use it in GitHub Desktop.
[concrete5 legacy] A job to deletes empty "Compare Versions" alerts.
<?php
defined('C5_EXECUTE') or die("Access Denied.");
class ClearEmptyWorkflowProgress extends Job
{
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 = PageWorkflowProgress::getPendingWorkflowProgressList();
$r = $list->get();
foreach ($r as $w) {
$wp = $w->getWorkflowProgressObject();
$wo = $wp->getWorkflowObject();
if ($wo instanceof EmptyWorkflow) {
$wp->delete();
}
}
}
}
@hissy
Copy link
Author

hissy commented Jun 11, 2020

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