performed code formatting
This commit is contained in:
@ -48,10 +48,12 @@ class PluginManager {
|
||||
$this->initTables();
|
||||
|
||||
$this->pluginMenu = new PluginMenu($maniaControl);
|
||||
$this->maniaControl->getConfigurator()->addMenu($this->pluginMenu);
|
||||
$this->maniaControl->getConfigurator()
|
||||
->addMenu($this->pluginMenu);
|
||||
|
||||
$this->pluginInstallMenu = new InstallMenu($maniaControl);
|
||||
$this->maniaControl->getConfigurator()->addMenu($this->pluginInstallMenu);
|
||||
$this->maniaControl->getConfigurator()
|
||||
->addMenu($this->pluginInstallMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +62,8 @@ class PluginManager {
|
||||
* @return bool
|
||||
*/
|
||||
private function initTables() {
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$mysqli = $this->maniaControl->getDatabase()
|
||||
->getMysqli();
|
||||
$pluginsTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLUGINS . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`className` varchar(100) NOT NULL,
|
||||
@ -153,22 +156,28 @@ class PluginManager {
|
||||
$plugin->unload();
|
||||
|
||||
if ($plugin instanceof CallbackListener) {
|
||||
$this->maniaControl->getCallbackManager()->unregisterCallbackListener($plugin);
|
||||
$this->maniaControl->getCallbackManager()->unregisterScriptCallbackListener($plugin);
|
||||
$this->maniaControl->getCallbackManager()
|
||||
->unregisterCallbackListener($plugin);
|
||||
$this->maniaControl->getCallbackManager()
|
||||
->unregisterScriptCallbackListener($plugin);
|
||||
}
|
||||
if ($plugin instanceof CommandListener) {
|
||||
$this->maniaControl->getCommandManager()->unregisterCommandListener($plugin);
|
||||
$this->maniaControl->getCommandManager()
|
||||
->unregisterCommandListener($plugin);
|
||||
}
|
||||
if ($plugin instanceof ManialinkPageAnswerListener) {
|
||||
$this->maniaControl->getManialinkManager()->unregisterManialinkPageAnswerListener($plugin);
|
||||
$this->maniaControl->getManialinkManager()
|
||||
->unregisterManialinkPageAnswerListener($plugin);
|
||||
}
|
||||
if ($plugin instanceof TimerListener) {
|
||||
$this->maniaControl->getTimerManager()->unregisterTimerListenings($plugin);
|
||||
$this->maniaControl->getTimerManager()
|
||||
->unregisterTimerListenings($plugin);
|
||||
}
|
||||
|
||||
$this->savePluginStatus($pluginClass, false);
|
||||
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLUGIN_UNLOADED, $pluginClass, $plugin);
|
||||
$this->maniaControl->getCallbackManager()
|
||||
->triggerCallback(self::CB_PLUGIN_UNLOADED, $pluginClass, $plugin);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -206,7 +215,8 @@ class PluginManager {
|
||||
* @return bool
|
||||
*/
|
||||
private function savePluginStatus($className, $active) {
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$mysqli = $this->maniaControl->getDatabase()
|
||||
->getMysqli();
|
||||
$pluginStatusQuery = "INSERT INTO `" . self::TABLE_PLUGINS . "` (
|
||||
`className`,
|
||||
`active`
|
||||
@ -328,7 +338,8 @@ class PluginManager {
|
||||
* @return bool
|
||||
*/
|
||||
public function getSavedPluginStatus($className) {
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$mysqli = $this->maniaControl->getDatabase()
|
||||
->getMysqli();
|
||||
$pluginStatusQuery = "SELECT `active` FROM `" . self::TABLE_PLUGINS . "`
|
||||
WHERE `className` = ?;";
|
||||
$pluginStatement = $mysqli->prepare($pluginStatusQuery);
|
||||
@ -379,7 +390,8 @@ class PluginManager {
|
||||
$plugin->load($this->maniaControl);
|
||||
} catch (\Exception $e) {
|
||||
$message = "Error during Plugin Activation of '{$pluginClass}': '{$e->getMessage()}'";
|
||||
$this->maniaControl->getChat()->sendError($message, $adminLogin);
|
||||
$this->maniaControl->getChat()
|
||||
->sendError($message, $adminLogin);
|
||||
Logger::logError($message);
|
||||
$this->savePluginStatus($pluginClass, false);
|
||||
return false;
|
||||
@ -388,7 +400,8 @@ class PluginManager {
|
||||
$this->activePlugins[$pluginClass] = $plugin;
|
||||
$this->savePluginStatus($pluginClass, true);
|
||||
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLUGIN_LOADED, $pluginClass, $plugin);
|
||||
$this->maniaControl->getCallbackManager()
|
||||
->triggerCallback(self::CB_PLUGIN_LOADED, $pluginClass, $plugin);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -463,7 +476,8 @@ class PluginManager {
|
||||
*/
|
||||
public function fetchPluginList(callable $function) {
|
||||
$url = ManiaControl::URL_WEBSERVICE . 'plugins';
|
||||
$this->maniaControl->getFileReader()->loadFile($url, function ($dataJson, $error) use (&$function) {
|
||||
$this->maniaControl->getFileReader()
|
||||
->loadFile($url, function ($dataJson, $error) use (&$function) {
|
||||
$data = json_decode($dataJson);
|
||||
call_user_func($function, $data, $error);
|
||||
});
|
||||
|
Reference in New Issue
Block a user