$this->set_id($id);
}
}
-
+
function class_name()
{
return ucfirst($this->transport()) . 'Handler';
{
return strtolower($this->class_name().'.'.$this->get_id());
}
-
+
function get_id()
{
return $this->_id;
{
$this->_id = $id;
}
-
+
function transport()
{
return null;
}
-
+
function start()
{
}
-
+
function finish()
{
}
{
return true;
}
-
+
function run()
{
if (!$this->start()) {
return false;
}
- $this->log(LOG_INFO, 'checking for queued notices');
$transport = $this->transport();
+ $this->log(LOG_INFO, 'checking for queued notices for "' . $transport . '"');
do {
$qi = Queue_item::top($transport);
if ($qi) {
} else {
$this->clear_old_claims();
$this->idle(5);
- }
+ }
} while (true);
if (!$this->finish()) {
return false;
sleep($timeout);
}
}
-
+
function clear_old_claims()
{
$qi = new Queue_item();
$qi->free();
unset($qi);
}
-
+
function log($level, $msg)
{
common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
}
}
-
\ No newline at end of file