From 9ba9f7bf2754988b7408c23c32b1f2a332528d29 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 4 Dec 2008 07:44:28 +0000 Subject: Change the startup code to only put installed modules on the autoload path. This breaks a bunch of places where we had hardcoded dependencies, so guard all of those cases. Restructure module::available() a bit and the way that we do install/uninstall in the scaffolding. --- core/helpers/module.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'core/helpers/module.php') diff --git a/core/helpers/module.php b/core/helpers/module.php index 4d977268..ca5b5cfb 100644 --- a/core/helpers/module.php +++ b/core/helpers/module.php @@ -65,7 +65,8 @@ class module_Core { } } - public static function available($modules=array()) { + 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; @@ -76,12 +77,15 @@ class module_Core { } public static function load_modules() { - $modules = Kohana::config('core.modules'); + try { + $modules = Kohana::config('core.modules'); - foreach (array_keys(self::available()) as $module_name) { - $modules[] = MODPATH . $module_name; - } + foreach (self::installed() as $module) { + $modules[] = MODPATH . $module->name; + } - Kohana::config_set('core.modules', $modules); + Kohana::config_set('core.modules', $modules); + } catch (Exception $e) { + } } } -- cgit v1.2.3