Bugfixes for module loading

This commit is contained in:
Abel Hoogeveen 2015-03-14 17:03:15 +01:00
parent b93dfb7d9c
commit 771727ca48
2 changed files with 9 additions and 6 deletions

View File

@ -65,9 +65,9 @@ class Core {
## MODLOADING ## MODLOADING
public function loadMod($name, $version = null) { public function loadMod($name, $version = null) {
if (!isset($this->mods->$name)) {
$CLASS = $this->loadModule($name); $CLASS = $this->loadModule($name);
$this->mods->{strtolower($CLASS[1])} = &$CLASS[0]; if (!isset($this->mods->{strtolower($CLASS[1])})) {
return $this->mods->{strtolower($CLASS[1])} = &$CLASS[0];
} }
} }
@ -98,6 +98,8 @@ class Core {
// Check if the module is enabled, otherwise abort // Check if the module is enabled, otherwise abort
if (isset($cfg->enabled)) { if (isset($cfg->enabled)) {
if (!$cfg->enabled) { if (!$cfg->enabled) {
// Module is disabled
throw new Exception("Module '".$name."' is not enabled!", 1);
return false; return false;
} }
} }

View File

@ -158,9 +158,10 @@ class Events extends Bus{
$dir = FUZEPATH . "/Core/Mods/"; $dir = FUZEPATH . "/Core/Mods/";
$mods = $this->config->modregister->register; $mods = $this->config->modregister->register;
foreach ($mods as $key => $value) { foreach ($mods as $key => $value) {
try {
$this->core->loadMod($key); $this->core->loadMod($key);
} catch (Exception $e) {}
} }
$event = $this->fireEvent('eventRegisterBuildEvent', ''); $event = $this->fireEvent('eventRegisterBuildEvent', '');
$this->config->set('eventregister', 'register', $event->register); $this->config->set('eventregister', 'register', $event->register);