X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fimdaemon.php;h=7d9ff1fe7dc7d1d65d0007c14e76219e713e196d;hb=d1046855fb1bd73ba2209a08eff78bd7cde06477;hp=ffb5ecf0d945fd98b3613bd920928b14836937b0;hpb=914bc9f9c5ce29584e00553104ac991e6e178e7b;p=quix0rs-gnu-social.git diff --git a/scripts/imdaemon.php b/scripts/imdaemon.php index ffb5ecf0d9..7d9ff1fe7d 100755 --- a/scripts/imdaemon.php +++ b/scripts/imdaemon.php @@ -20,36 +20,41 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -$shortoptions = 'fi::'; -$longoptions = array('id::', 'foreground'); +$shortoptions = 'fi::a'; +$longoptions = array('id::', 'foreground', 'all'); $helptext = <<allsites = $allsites; } function runThread() { common_log(LOG_INFO, 'Waiting to listen to IM connections and queues'); - $master = new ImMaster($this->get_id()); - $master->init(); + $master = new ImMaster($this->get_id(), $this->processManager()); + $master->init($this->allsites); $master->service(); common_log(LOG_INFO, 'terminating normally'); @@ -61,6 +66,14 @@ class ImDaemon extends SpawningDaemon class ImMaster extends IoMaster { + protected $processManager; + + function __construct($id, $processManager) + { + parent::__construct($id); + $this->processManager = $processManager; + } + /** * Initialize IoManagers for the currently configured site * which are appropriate to this instance. @@ -69,7 +82,10 @@ class ImMaster extends IoMaster { $classes = array(); if (Event::handle('StartImDaemonIoManagers', array(&$classes))) { - $classes[] = 'QueueManager'; + $qm = QueueManager::get(); + $qm->setActiveGroup('im'); + $classes[] = $qm; + $classes[] = $this->processManager; } Event::handle('EndImDaemonIoManagers', array(&$classes)); foreach ($classes as $class) { @@ -87,7 +103,8 @@ if (have_option('i', 'id')) { } $foreground = have_option('f', 'foreground'); +$all = have_option('a') || have_option('--all'); -$daemon = new ImDaemon($id, !$foreground); +$daemon = new ImDaemon($id, !$foreground, 1, $all); $daemon->runOnce();