. */ if (!defined('GNUSOCIAL')) { exit(1); } class RunqueueAction extends Action { protected $qm = null; protected function prepare(array $args=array()) { parent::prepare($args); $args = array(); foreach (array('qmkey') as $key) { if ($this->arg($key) !== null) { $args[$key] = $this->arg($key); } } try { $this->qm = new OpportunisticQueueManager($args); } catch (RunQueueBadKeyException $e) { return false; } header('Content-type: text/plain; charset=utf-8'); return true; } protected function handle() { // We don't need any of the parent functionality from parent::handle() here. // runQueue is a loop that works until limits have passed or there is no more work if ($this->qm->runQueue() === true) { // We don't have any more work $this->text('0'); } else { // There were still items left in queue when we aborted $this->text('1'); } } }