summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-11-28 21:22:34 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-11-28 21:22:34 +0000
commit6a76d6f747768106f8bccd8b74059371dbac615a (patch)
tree4075552e99833a5a721ca17f6815bacb7baa0fc4 /core/helpers
parent8b6ed6c477771e42d43ea0684e5139cf361b6cee (diff)
Dynamically create the list of available modules. This permits new modules to be added without having to update the config.php file
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/module.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/helpers/module.php b/core/helpers/module.php
index afba658a..599cc618 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -64,4 +64,26 @@ class module_Core {
}
}
}
+
+ public static function available($modules=array()) {
+ foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) {
+ if (empty($modules[basename(dirname(dirname($file)))])) {
+ $modules[basename(dirname(dirname($file)))] = 0;
+ }
+ }
+
+ return $modules;
+ }
+
+ public static function load_modules() {
+ Kohana::log("debug", "module::load_modules()");
+ $modules = Kohana::config('core.modules');
+
+ foreach (array_keys(self::available()) as $module_name) {
+ $modules[] = MODPATH . $module_name;
+ }
+ Kohana::log("debug", print_r($modules, true));
+
+ Kohana::config_set('core.modules', $modules);
+ }
}