diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-01-09 18:33:48 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-01-09 18:33:48 +0000 |
commit | 22ee0127205da3470c97222e6ae0f1f13c86b074 (patch) | |
tree | e75c9849dbf781836b3139a7fbf74c99d10422dd /core/helpers/module.php | |
parent | b5fbee54a0d8f7a734a49bd4b6ea183ad9fa380e (diff) |
Stage 1 of the installer. basically check that we can start as far as Kohana correctly
Diffstat (limited to 'core/helpers/module.php')
-rw-r--r-- | core/helpers/module.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/core/helpers/module.php b/core/helpers/module.php index 4b98674e..de81c0bb 100644 --- a/core/helpers/module.php +++ b/core/helpers/module.php @@ -1,3 +1,4 @@ + <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor @@ -132,6 +133,7 @@ class module_Core { /** * Uninstall a module. + */ public static function uninstall($module_name) { $installer_class = "{$module_name}_installer"; @@ -147,21 +149,21 @@ class module_Core { // Reload module list from the config file since we'll do a refresh after calling install() $core = Kohana::config_load('core'); $kohana_modules = $core['modules']; - self::$module_names = array(); - self::$modules = array(); - // This is one of the first database operations that we'll do, so it may fail if there's no - // install yet. Try to handle this situation gracefully expecting that the scaffolding will - // Do The Right Thing. - // - // @todo get rid of this extra error checking when we have an installer. - set_error_handler(array("module", "dummy_error_handler")); - try { - $modules = ORM::factory("module")->find_all(); - } catch (Exception $e) { + // Check that we are installed. If not then head over to the installer. + $installed = Kohana::config("gallery.installed", false, false); + if (empty($installed)) { + $kohana_modules[] = DOCROOT . "installer"; + Kohana::config_set('core.modules', $kohana_modules); + $routes = Kohana::config("routes"); + $routes["_default"] = "installer"; + Kohana::config_set("routes", $routes); return; } - restore_error_handler(); + self::$module_names = array(); + self::$modules = array(); + + $modules = ORM::factory("module")->find_all(); try { foreach ($modules as $module) { |