#!/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 XmppMaster extends IoMaster { /** * Initialize IoManagers for the currently configured site * which are appropriate to this instance. */ function initManagers() { // @fixme right now there's a hack in QueueManager to determine // which queues to subscribe to based on the master class. $this->instantiate('QueueManager'); $this->instantiate('XmppManager'); } } // Abort immediately if xmpp is not enabled, otherwise the daemon chews up // lots of CPU trying to connect to unconfigured servers if (common_config('xmpp','enabled')==false) { print "Aborting daemon - xmpp is disabled\n"; exit(); } 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 XMPPDaemon($id, !$foreground); $daemon->runOnce();