diff options
author | Simon Rettberg | 2017-11-03 13:17:50 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-11-03 13:17:50 +0100 |
commit | 8ec19d91564255a9e701965e6cfcdffe17e685cf (patch) | |
tree | c54837af11b9bcbc8201795581e647a1dc71903c /inc/module.inc.php | |
parent | api.php: Support numbers in module names (diff) | |
download | slx-admin-8ec19d91564255a9e701965e6cfcdffe17e685cf.tar.gz slx-admin-8ec19d91564255a9e701965e6cfcdffe17e685cf.tar.xz slx-admin-8ec19d91564255a9e701965e6cfcdffe17e685cf.zip |
[inc/module] Fix sorting bug, show errors in debug mode, add optional param to isAvailable()
Diffstat (limited to 'inc/module.inc.php')
-rw-r--r-- | inc/module.inc.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/inc/module.inc.php b/inc/module.inc.php index 7211c68c..ec3d095b 100644 --- a/inc/module.inc.php +++ b/inc/module.inc.php @@ -29,12 +29,14 @@ class Module * @param string $moduleId module to check * @return bool true if module is available and activated */ - public static function isAvailable($moduleId) + public static function isAvailable($moduleId, $activate = true) { $module = self::get($moduleId); if ($module === false) return false; - $module->activate(); + if ($activate) { + $module->activate(); + } return !$module->hasMissingDependencies(); } @@ -56,7 +58,7 @@ class Module $mod->depsChecked = true; foreach ($mod->dependencies as $dep) { if (!self::resolveDepsByName($dep)) { - error_log("Disabling module {$mod->name}: Dependency $dep failed."); + trigger_error("Disabling module {$mod->name}: Dependency $dep failed.", E_USER_WARNING); $mod->depsMissing = true; return false; } @@ -75,9 +77,9 @@ class Module foreach (self::$modules as $module) { if (self::resolveDeps($module)) { $ret[] = $module; - } - if ($sortById) { - $sort[] = $module->name; + if ($sortById) { + $sort[] = $module->name; + } } } if ($sortById) { |