#!/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 $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();