function close($onPurpose = true) { if ($this->server) { if ($onPurpose) { $this->server->notifyUnregister(); foreach ($this->privilegeKeys as $key) { $this->server->privilegeKeyDelete($key); } } $this->server->clientListReset(); $this->server->channelListReset(); $this->server = null; $this->playersGroupId = 0; $this->privilegeKeys = array(); } if ($this->processHandler && $this->processId) { $this->processHandler->killThread($this->processId); $this->processId = null; } Dispatcher::unregister(AppEvent::getClass(), $this); Dispatcher::unregister(TickEvent::getClass(), $this); // TODO something to avoid memory leaks when unloading the plugin // but the TS framework is f*cked up (plenty of circular references // which can't be unset from outside...) }
protected function __construct() { $this->enabled = extension_loaded('mysql') && Config::getInstance()->enabled; if ($this->enabled) { $this->setUpDatabase(); $this->setData('config', \ManiaLive\Config\Config::getInstance()); $this->setData('wsapi', \ManiaLive\Features\WebServices\Config::getInstance()); $this->setData('manialive', \ManiaLive\Application\Config::getInstance()); $this->setData('server', \ManiaLive\DedicatedApi\Config::getInstance()); $this->setData('threading', \ManiaLive\Threading\Config::getInstance()); } else { Logger::debug('Application started with threading disabled!', true, array('Process #' . getmypid())); $this->buffers[0] = array(); } Dispatcher::register(TickEvent::getClass(), $this); }
function stop() { $this->running = false; Dispatcher::unregister(AppEvent::getClass(), $this); Dispatcher::unregister(TickEvent::getClass(), $this); }
/** * (non-PHPdoc) * @see libraries/ManiaLive/Features/Tick/ManiaLive\Features\Tick.Listener::onTick() */ public function onTick() { if (time() >= $this->timeout) { $this->timeout = false; $this->hide(); Dispatcher::unregister(TickEvent::getClass(), $this); } }
protected function __construct() { $this->lastDisplayed = 0; Dispatcher::register(TickEvent::getClass(), $this); }
function disconnect() { if (!mysql_close($this->connection)) { throw new DisconnectionException(); } $this->connection = null; Dispatcher::unregister(TickEvent::getClass(), $this); }
/** * Stop listening for the ticker event. */ protected final function disableTickerEvent() { $this->restrictIfUnloaded(); Dispatcher::unregister(TickEvent::getClass(), $this); $this->eventsTick = false; }