Adding Ajax API, fix some module handlings, add new load method for modules

This commit is contained in:
Adrian Preuß committed 2019-04-16 20:10:26 +02:00
1 parent ecc278de48
commit 6723246bf2
7 files changed
+109 -30

No files matched your search

+12 -1
View File
@@ -7,6 +7,11 @@
public function __construct($core) {
$this->core = $core;
$enabled = [];
foreach(Database::fetch('SELECT `name` FROM `fh_modules` WHERE `state`=\'ENABLED\'') AS $entry) {
$enabled[] = $entry->name;
}
foreach(new \DirectoryIterator($this->getPath()) AS $info) {
if($info->isDot()) {
@@ -14,8 +19,10 @@
}
$path = sprintf('%s%s%s', $this->getPath(), DS, $info->getFilename());
$module = new Module($path);
$module->setEnabled(in_array(basename($path), $enabled));
$this->addModule(basename($path), new Module($path));
$this->addModule(basename($path), $module);
}
}
@@ -24,6 +31,10 @@
}
public function addModule($name, $module) {
if(!$module->isEnabled()) {
return;
}
$this->modules[$name] = $module->init($this->core);
}