summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-06-14 22:42:32 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-06-15 09:14:10 -0700
commit7e5661cf49aa2239fb71e7feb289e2dfee926e3d (patch)
tree0015edf6d7aa758911a973741b97a2e6c82d0b33 /modules
parentb2afba1db1184fcf491bbdf7f0a50ddb5615e26f (diff)
Add a simple/cheap test to make sure that the database config is ok. Fixes ticket #1029.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/hooks/init_gallery.php9
1 files changed, 9 insertions, 0 deletions
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"));