3 class OpportunisticQMPlugin extends Plugin {
4 const PLUGIN_VERSION = '2.0.0';
7 public $secs_per_action = 1; // total seconds to run script per action
8 public $rel_to_pageload = true; // relative to pageload or queue start
11 public function onRouterInitialized($m)
13 $m->connect('main/runqueue', array('action' => 'runqueue'));
17 * When the page has finished rendering, let's do some cron jobs
18 * if we have the time.
20 public function onEndActionExecute(Action $action)
22 if ($action instanceof RunqueueAction) {
29 'qmkey' => common_config('opportunisticqm', 'qmkey'),
30 'max_execution_time' => $this->secs_per_action,
31 'started_at' => $this->rel_to_pageload ? $_startTime : null,
32 'verbosity' => $this->verbosity,
34 $qm = new OpportunisticQueueManager($args);
39 public function onPluginVersion(array &$versions)
41 $versions[] = array('name' => 'OpportunisticQM',
42 'version' => self::PLUGIN_VERSION,
43 'author' => 'Mikael Nordfeldth',
44 'homepage' => 'http://www.gnu.org/software/social/',
46 // TRANS: Plugin description.
47 _m('Opportunistic queue manager plugin for background processing.'));