From 91a0236f8cdea57f70433f0f90a4f60f9418cbad Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 5 Nov 2008 22:29:42 +0000 Subject: Guard the module loading code against database errors (in case the database isn't configured yet) --- core/controllers/welcome.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/controllers') diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 4a3dacb4..f68813c3 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -23,14 +23,17 @@ class Welcome_Controller extends Template_Controller { function index() { $this->template->syscheck = new View("welcome_syscheck.html"); $this->template->syscheck->errors = $this->_get_config_errors(); - $this->template->syscheck->modules = $this->_read_modules(); + $this->templlate->syscheck->modules = array(); $this->template->album_count = 0; $this->template->photo_count = 0; try { + $old_handler = set_error_handler(array("Welcome_Controller", "_error_handler")); + $this->template->syscheck->modules = $this->_read_modules(); $this->template->album_count = ORM::factory("item")->where("type", "album")->count_all(); $this->template->photo_count = ORM::factory("item")->where("type", "photo")->count_all(); } catch (Exception $e) { } + set_error_handler($old_handler); $this->_create_directories(); } @@ -119,7 +122,7 @@ class Welcome_Controller extends Template_Controller { if (!file_exists($db_php)) { $error = new stdClass(); $error->message = "Missing: $db_php"; - $error->instructions[] = "cp kohana/config/database.php $db_php"; + $error->instructions[] = "cp " . DOCROOT . "kohana/config/database.php $db_php"; $error->instructions[] = "chmod 644 $db_php"; $error->message2 = "Then edit this file and enter your database configuration settings."; $errors[] = $error; -- cgit v1.2.3