From 35067cbced6dadbc4cb7e7a45334485320eb473b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 12 Dec 2008 01:22:03 +0000 Subject: Expand on our core-is-installed checking code. --- core/helpers/module.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'core/helpers/module.php') diff --git a/core/helpers/module.php b/core/helpers/module.php index eddac2f0..bc786fad 100644 --- a/core/helpers/module.php +++ b/core/helpers/module.php @@ -48,10 +48,18 @@ class module_Core { } public static function is_installed($module_name) { + if (!self::_core_installed()) { + return false; + } + return ORM::factory("module")->where("name", $module_name)->find()->loaded; } public static function installed() { + if (!self::_core_installed()) { + return array(); + } + return ORM::factory("module")->find_all(); } @@ -77,9 +85,7 @@ class module_Core { } public static function load_modules() { - // Lightweight hack to make sure that we've got a real install. - // @todo replace this when we have a better way of detecting that the core is installed - if (Kohana::config('database.default.connection.pass') == 'p@ssw0rd') { + if (!self::_core_installed()) { return array(); } @@ -118,4 +124,15 @@ class module_Core { $var->value = $value; $var->save(); } + + /** + * Lightweight hack to make sure that we've got a real install. + * + * @todo remove this when we have a real installer. + */ + private static function _core_installed() { + if (Kohana::config('database.default.connection.pass') == 'p@ssw0rd') { + return array(); + } + } } -- cgit v1.2.3