summaryrefslogtreecommitdiffstats
path: root/modules-available/baseconfig
diff options
context:
space:
mode:
authorSimon Rettberg2016-06-23 17:00:47 +0200
committerSimon Rettberg2016-06-23 17:00:47 +0200
commit4138010a713fea558a6be3be1206ddf02d7296da (patch)
tree5bc6691c99fe8d0d6c915af0d7962babb35ad12c /modules-available/baseconfig
parent[module] Add getDependencies() to recursively get all deps of a module (diff)
downloadslx-admin-4138010a713fea558a6be3be1206ddf02d7296da.tar.gz
slx-admin-4138010a713fea558a6be3be1206ddf02d7296da.tar.xz
slx-admin-4138010a713fea558a6be3be1206ddf02d7296da.zip
[baseconfig] Take dependencies into account when handling API hooks
Diffstat (limited to 'modules-available/baseconfig')
-rw-r--r--modules-available/baseconfig/api.inc.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules-available/baseconfig/api.inc.php b/modules-available/baseconfig/api.inc.php
index 877ff4a7..af780d99 100644
--- a/modules-available/baseconfig/api.inc.php
+++ b/modules-available/baseconfig/api.inc.php
@@ -33,15 +33,23 @@ $configVars = array();
function handleModule($file, $ip, $uuid) // Pass ip and uuid instead of global to make them read only
{
global $configVars;
- include $file;
+ include_once $file;
}
// Handle any hooks by other modules first
// other modules should generally only populate $configVars
foreach (glob('modules/*/baseconfig/getconfig.inc.php') as $file) {
preg_match('#^modules/([^/]+)/#', $file, $out);
- if (!Module::isAvailable($out[1]))
+ $mod = Module::get($out[1]);
+ if ($mod === false)
continue;
+ $mod->activate();
+ foreach ($mod->getDependencies() as $dep) {
+ $depFile = 'modules/' . $dep . '/baseconfig/getconfig.inc.php';
+ if (file_exists($depFile) && Module::isAvailable($dep)) {
+ handleModule($depFile, $ip, $uuid);
+ }
+ }
handleModule($file, $ip, $uuid);
}