From 7e5661cf49aa2239fb71e7feb289e2dfee926e3d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 14 Jun 2010 22:42:32 -0700 Subject: Add a simple/cheap test to make sure that the database config is ok. Fixes ticket #1029. --- modules/gallery/hooks/init_gallery.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/gallery/hooks') diff --git a/modules/gallery/hooks/init_gallery.php b/modules/gallery/hooks/init_gallery.php index 10383e9a..64e44b56 100644 --- a/modules/gallery/hooks/init_gallery.php +++ b/modules/gallery/hooks/init_gallery.php @@ -24,6 +24,15 @@ if (!file_exists(VARPATH . "database.php")) { url::redirect(url::abs_file("installer")); } +// Simple and cheap test to make sure that the database config is ok. Do this before we do +// anything else database related. +try { + Database::instance()->connect(); +} catch (Kohana_PHP_Exception $e) { + print "Database configuration error. Please check var/database.php"; + exit; +} + Event::add("system.ready", array("Gallery_I18n", "instance")); Event::add("system.ready", array("module", "load_modules")); Event::add("system.ready", array("gallery", "ready")); -- cgit v1.2.3