From: Craig Andrews Date: Thu, 28 Jan 2010 03:07:04 +0000 (-0500) Subject: Merge branch '0.9.x' into 1.0.x X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=914bc9f9c5ce29584e00553104ac991e6e178e7b;p=quix0rs-gnu-social.git Merge branch '0.9.x' into 1.0.x Conflicts: lib/queuemanager.php --- 914bc9f9c5ce29584e00553104ac991e6e178e7b diff --cc scripts/imdaemon.php index c37a26b7c0,0000000000..ffb5ecf0d9 mode 100755,000000..100755 --- a/scripts/imdaemon.php +++ b/scripts/imdaemon.php @@@ -1,93 -1,0 +1,93 @@@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'fi::'; +$longoptions = array('id::', 'foreground'); + +$helptext = <<get_id()); + $master->init(); + $master->service(); + + common_log(LOG_INFO, 'terminating normally'); + - return true; ++ return $master->respawn ? self::EXIT_RESTART : self::EXIT_SHUTDOWN; + } + +} + +class ImMaster extends IoMaster +{ + /** + * Initialize IoManagers for the currently configured site + * which are appropriate to this instance. + */ + function initManagers() + { + $classes = array(); + if (Event::handle('StartImDaemonIoManagers', array(&$classes))) { + $classes[] = 'QueueManager'; + } + Event::handle('EndImDaemonIoManagers', array(&$classes)); + foreach ($classes as $class) { + $this->instantiate($class); + } + } +} + +if (have_option('i', 'id')) { + $id = get_option_value('i', 'id'); +} else if (count($args) > 0) { + $id = $args[0]; +} else { + $id = null; +} + +$foreground = have_option('f', 'foreground'); + +$daemon = new ImDaemon($id, !$foreground); + +$daemon->runOnce();