pluginmanager fix

This commit is contained in:
kremsy 2014-02-14 18:17:05 +01:00 committed by Steffen Schröder
parent 3022e33bda
commit e4a0ac2207
2 changed files with 15 additions and 7 deletions

View File

@ -304,12 +304,12 @@ class ManiaControl implements CommandListener {
$this->callbackManager->manageCallbacks();
} catch(Exception $e) {
if ($e->getMessage() == 'Connection interupted' || $e->getMessage() == 'transport error - connection interrupted!') {
$this->quit($e->getMessage());
return;
}
throw $e;
if ($e->getMessage() == 'Connection interupted' || $e->getMessage() == 'transport error - connection interrupted!') {
$this->quit($e->getMessage());
return;
}
throw $e;
}
// Manage FileReader
$this->fileReader->appendData();

View File

@ -180,16 +180,23 @@ class PluginManager {
return true;
}
/**
* Load complete plugins directory and start all configured plugins
*/
public function loadPlugins() {
$pluginsDirectory = ManiaControlDir . '/plugins/';
public function loadPlugins($dir = '') {
$pluginsDirectory = ManiaControlDir . '/plugins/' . $dir . '/';
$pluginFiles = scandir($pluginsDirectory, 0);
foreach($pluginFiles as $pluginFile) {
if (stripos($pluginFile, '.') === 0) {
continue;
}
if (is_dir($pluginsDirectory . $pluginFile)) {
$this->loadPlugins($pluginFile);
continue;
}
$classesBefore = get_declared_classes();
$success = include_once $pluginsDirectory . $pluginFile;
if (!$success) {
@ -201,6 +208,7 @@ class PluginManager {
if (!$this->isPluginClass($className)) {
continue;
}
//Prepare Plugin
$className::prepare($this->maniaControl);