Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active March 14, 2023 19:58
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • 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();
}
}
}
}
@hissy
Copy link
Author

hissy commented Mar 21, 2015

Usage:

  1. Upload this file to your_site_root/application/jobs/clear_empty_workflow_progress.php
  2. Clear cache from your dashboard
  3. Go to "Automated Jobs" page in dashboard, and install this job
  4. Run the job

@WillemAnchor
Copy link

nice, thanks

@Mesuva
Copy link

Mesuva commented May 25, 2015

Awesome work Hissy, many thanks for this, this resolves a really annoying issue when developing!

@baardev
Copy link

baardev commented Aug 14, 2015

wow! this worked exactly as advertised :) many thanks

@a3020
Copy link

a3020 commented Nov 20, 2015

Works perfectly. (y)

@pmcoz
Copy link

pmcoz commented May 10, 2016

Please accept additional thanks.

@ob7
Copy link

ob7 commented May 26, 2016

Wheres the donation jar?

@zanedev
Copy link

zanedev commented Jul 6, 2016

Thanks works as advertised!

@OKDnet
Copy link

OKDnet commented Jul 13, 2016

For the same issue in a 5.7.5.8 install this was just pointed out to me and worked like a charm. Thanks hissy.

@pixel-fields
Copy link

Thank you so much, the pop up was driving me crazy! Instructions worked perfectly.

@JirosWorld
Copy link

Should this work for Concrete5.8? Because I get php errors as of version 8.2.1.

@tomothy83
Copy link

Thank you very much. Worked perfectly.

@madesimplemedia
Copy link

Awesome thanks!

@hissy
Copy link
Author

hissy commented Jun 11, 2020

@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