Last active
March 14, 2023 19:58
-
-
Save hissy/5ea2147516a90710919d to your computer and use it in GitHub Desktop.
[concrete5] A job to deletes empty "Compare Versions" alerts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} | |
} | |
} | |
} |
Thank you very much. Worked perfectly.
Awesome thanks!
Legacy Version: https://gist.github.com/hissy/ea2bfd97641d0dbc3b7485cb66d80e15
More thanks coming your way! @hissy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should this work for Concrete5.8? Because I get php errors as of version 8.2.1.