diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-01-12 05:12:17 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-01-12 05:12:17 +0000 |
commit | e02c5759bba275c273ab16d8923bff3ea6f24663 (patch) | |
tree | 1e1b103932f62768200f3171b451aaa770ccd4ea /installer/helpers | |
parent | d880c0b7e204d3b232bfc85919f80bade8c638d9 (diff) |
Add a check to (e|i)nsure that the database provided is empty
Diffstat (limited to 'installer/helpers')
-rw-r--r-- | installer/helpers/installer.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/installer/helpers/installer.php b/installer/helpers/installer.php index 9214060d..640e4335 100644 --- a/installer/helpers/installer.php +++ b/installer/helpers/installer.php @@ -274,6 +274,15 @@ class installer { "error" => false); } + $tables = self::$database->list_tables(self::$config["dbname"]); + + $valid = count($tables) == 0; + if (!$valid) { + $db_config_valid = false; + $section["msgs"]["Database Empty"] = array("text" => "Database '$dbname' is not empty", + "error" => true); + } + $missing = array(); $rights = self::$database->get_access_rights($dbname); @@ -292,7 +301,6 @@ class installer { "error" => false); } - self::$messages[] = $section; return $db_config_valid; @@ -314,7 +322,7 @@ class installer { "error" => true); } self::$messages[] = $section; - return $writable; + return !$writable; } private static function _render($view) { |