3 class OpportunisticQMPlugin extends Plugin {
5 public $secs_per_action = 1; // total seconds to run script per action
6 public $rel_to_pageload = true; // relative to pageload or queue start
8 public function onRouterInitialized($m)
10 $m->connect('main/runqueue', array('action' => 'runqueue'));
14 * When the page has finished rendering, let's do some cron jobs
15 * if we have the time.
17 public function onEndActionExecute(Action $action)
19 if ($action instanceof RunqueueAction) {
26 'qmkey' => common_config('opportunisticqm', 'qmkey'),
27 'max_execution_time' => $this->secs_per_action,
28 'started_at' => $this->rel_to_pageload ? $_startTime : null,
30 $qm = new OpportunisticQueueManager($args);
35 public function onPluginVersion(array &$versions)
37 $versions[] = array('name' => 'OpportunisticQM',
38 'version' => GNUSOCIAL_VERSION,
39 'author' => 'Mikael Nordfeldth',
40 'homepage' => 'http://www.gnu.org/software/social/',
42 // TRANS: Plugin description.
43 _m('Opportunistic queue manager plugin for background processing.'));