X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fqueuehandler.php;h=9ce9e32b3b718f1d60375607aefbf194cdbcb156;hb=2935e8c7ce3a9a31b9191d4a02cb8cab348c68e6;hp=ecf58f69f9cbdb801c068838aeb47492ecc6aefb;hpb=eb2f9c98ac115ce67e9a740b200c832153ffa05c;p=quix0rs-gnu-social.git diff --git a/lib/queuehandler.php b/lib/queuehandler.php index ecf58f69f9..9ce9e32b3b 100644 --- a/lib/queuehandler.php +++ b/lib/queuehandler.php @@ -25,47 +25,58 @@ require_once(INSTALLDIR.'/lib/daemon.php'); require_once(INSTALLDIR.'/classes/Queue_item.php'); require_once(INSTALLDIR.'/classes/Notice.php'); -class QueueHandler extends Daemon { +class QueueHandler extends Daemon +{ var $_id = 'generic'; - function QueueHandler($id=null) { + function QueueHandler($id=null) + { if ($id) { $this->set_id($id); } } - function class_name() { + function class_name() + { return ucfirst($this->transport()) . 'Handler'; } - function name() { + function name() + { return strtolower($this->class_name().'.'.$this->get_id()); } - function get_id() { + function get_id() + { return $this->_id; } - function set_id($id) { + function set_id($id) + { $this->_id = $id; } - function transport() { + function transport() + { return null; } - function start() { + function start() + { } - function finish() { + function finish() + { } - function handle_notice($notice) { + function handle_notice($notice) + { return true; } - function run() { + function run() + { if (!$this->start()) { return false; } @@ -110,13 +121,15 @@ class QueueHandler extends Daemon { return true; } - function idle($timeout=0) { + function idle($timeout=0) + { if ($timeout>0) { sleep($timeout); } } - function clear_old_claims() { + function clear_old_claims() + { $qi = new Queue_item(); $qi->transport = $this->transport(); $qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT); @@ -125,7 +138,8 @@ class QueueHandler extends Daemon { unset($qi); } - function log($level, $msg) { + function log($level, $msg) + { common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg); } }