function unloadPlugin($login, $classname)
 {
     $this->connection->chatSendServerMessage('Unloading ' . $classname, $login);
     try {
         PluginHandler::getInstance()->unload($classname);
     } catch (\Exception $e) {
         $this->connection->chatSendServerMessage('$900failed to unload ' . $classname . "\nSee logs for more details", $login);
         throw new \Exception($e->getMessage(), $e->getCode(), $e);
     }
 }
Exemplo n.º 2
0
 final function __construct()
 {
     $this->dependencies = array();
     $this->methods = array();
     $this->id = "\\" . get_class($this);
     $this->setVersion(1);
     $config = \ManiaLive\DedicatedApi\Config::getInstance();
     $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password);
     $this->pluginHandler = PluginHandler::getInstance();
     $this->storage = Storage::getInstance();
     $this->chatCommands = array();
 }
Exemplo n.º 3
0
 protected function init()
 {
     new \ManiaLive\Features\Tick\Ticker();
     $config = \ManiaLive\DedicatedApi\Config::getInstance();
     $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password);
     $this->connection->enableCallbacks(true);
     \ManiaLive\Data\Storage::getInstance();
     \ManiaLive\Features\ChatCommand\Interpreter::getInstance();
     \ManiaLive\Features\EchoHandler::getInstance();
     \ManiaLive\Gui\GuiHandler::getInstance();
     \ManiaLive\PluginHandler\PluginHandler::getInstance();
     \ManiaLive\Threading\ThreadHandler::getInstance();
     Dispatcher::dispatch(new Event(Event::ON_INIT));
 }
Exemplo n.º 4
0
 final function __construct()
 {
     $this->dependencies = array();
     $this->methods = array();
     $items = explode('\\', get_class($this));
     $this->author = $items[1];
     $this->name = $items[2];
     $this->id = $this->author . '\\' . $this->name;
     $this->setVersion(1);
     $config = \ManiaLive\DedicatedApi\Config::getInstance();
     $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password);
     $this->pluginHandler = PluginHandler::getInstance();
     $this->storage = Storage::getInstance();
     $this->chatCommands = array();
 }
Exemplo n.º 5
0
 function __construct($pluginName, $manager)
 {
     $this->sizeY = 6;
     $this->background = new BgsPlayerCard();
     $this->background->setSubStyle(BgsPlayerCard::BgCardSystem);
     $this->addComponent($this->background);
     $this->pluginName = new Label();
     $this->pluginName->setText('$fff' . $pluginName . '$z');
     $this->addComponent($this->pluginName);
     $this->loadState = new Label();
     $this->addComponent($this->loadState);
     $this->loadButton = new Icons64x64_1(7);
     $this->addComponent($this->loadButton);
     $this->loadAction = $this->createAction(array($manager, 'loadPlugin'), $pluginName);
     $this->unloadAction = $this->createAction(array($manager, 'unloadPlugin'), $pluginName);
     $this->setIsLoaded(PluginHandler::getInstance()->isLoaded($pluginName));
 }
Exemplo n.º 6
0
 /**
  * Is the plugin currently loaded or not?
  * @param string $name
  * @return bool
  */
 public final function isPluginLoaded($pluginId, $min = Dependency::NO_LIMIT, $max = Dependency::NO_LIMIT)
 {
     return $this->pluginHandler->isLoaded($pluginId, $min, $max);
 }
Exemplo n.º 7
0
 function showPluginManager($login)
 {
     PluginHandler::getInstance()->callPublicMethod(Profiler::$me, 'Standard\\PluginManager', 'openWindow', array($login));
 }
Exemplo n.º 8
0
 function onDraw()
 {
     // statistics for memory usage
     $memory = memory_get_usage();
     $text = '$oPHP Memory$z' . "\n" . 'Current Memory Usage: ' . round($memory / 1024) . " kb\n" . 'Total Peak Memory: ' . round(memory_get_peak_usage() / 1024) . " kb\n" . 'PHP Memory Limit: ' . round($this->memoryLimit / 1024) . " kb\n" . 'Amount Used: ' . round(100 * $memory / $this->memoryLimit, 2) . "%\n" . '$oPHP Speed$z' . "\n";
     if (empty($this->cpuStats)) {
         $text .= '$iRetrieving information...$z' . "\n";
     } else {
         $text .= 'Current Cycles per Second: ' . end($this->cpuStats) . "\n" . 'Avg Reaction Time: ' . round(1000 * count($this->cpuStats) / (array_sum($this->cpuStats) ?: 1)) . " msecs\n";
     }
     // manialive specific stats
     $text .= '$oManiaLive$z' . "\n";
     // runtime
     $diff = time() - \ManiaLive\Application\AbstractApplication::$startTime;
     $seconds = $diff % 60;
     $minutes = floor($diff % 3600 / 60);
     $hours = floor($diff % 86400 / 3600);
     $days = floor($diff / 86400);
     $text .= "ManiaLive Uptime:\n{$days} days and {$hours} hours\n{$minutes} min and {$seconds} seconds\n";
     // threading
     $text .= '$oThreading$z' . "\n";
     $processHandler = ThreadHandler::getInstance();
     if ($processHandler->isEnabled()) {
         $text .= 'Enabled; Running:' . $processHandler->countThreads() . '; Restarted:' . $processHandler->countRestartedThreads() . "\n" . $processHandler->countFinishedCommands() . ' commands finished at avg ' . round($processHandler->getAverageResponseTime(), 3) . ' ms';
     } else {
         $text .= "Disabled\n";
     }
     // update left side of the page
     $this->leftLabel->setText($text);
     // database
     $text = '$oDatabase$z' . "\n";
     $times = Connection::getMeasuredAverageTimes();
     if (count($times)) {
         $i = 0;
         foreach ($times as $time) {
             $text .= 'Connection #' . ++$i . ":\n" . 'Avg Query Time: ' . round($time, 3) . ' sec' . "\n";
         }
     } else {
         $text .= "No Database connections running.\n";
     }
     // network
     $text .= '$oNetwork$z' . "\n" . 'Total Bytes Sent: ' . round(Client::$sent / 1024) . "kb\n" . 'Total Bytes Received: ' . round(Client::$received / 1024) . "kb\n" . '$oInterface Drawing$z' . "\n" . 'Avg Drawing Time: ' . round(GuiHandler::getInstance()->getAverageSendingTimes() * 1000) . " msec\n" . '$oPlugins$z' . "\n" . 'Currently loaded: ' . count(PluginHandler::getInstance()->getLoadedPluginsList());
     // update right side of the page
     $this->rightLabel->setText($text);
 }