From 7778d4c05075e67f096d3d5365e5ae35e1b0a737 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 6 Jan 2010 10:11:03 -0800 Subject: Provide an error message when the sql in installer::empty_db fails. Also change the show tables not to specify a database as it will use the database in the active connection. Fixes ticket #963. --- installer/cli.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'installer/cli.php') diff --git a/installer/cli.php b/installer/cli.php index f736ffcb..e88293ff 100644 --- a/installer/cli.php +++ b/installer/cli.php @@ -41,10 +41,14 @@ if (!installer::connect($config)) { } else if (!installer::select_db($config)) { oops("Database {$config['dbname']} doesn't exist and can't be created. " . "Please create the database by hand."); -} else if (!installer::db_empty($config)) { - oops("Database {$config['dbname']} already has Gallery 3 tables in it. \n" . - " Please remove the Gallery 3 tables, change your prefix,\n" . - " or specify an empty database.\n"); +} else if (is_string($count = installer::db_empty($config)) || !$count) { + if (is_string($count)) { + oops($count); + } else { + oops("Database {$config['dbname']} already has Gallery 3 tables in it. \n" . + " Please remove the Gallery 3 tables, change your prefix,\n" . + " or specify an empty database.\n"); + } } else if (!installer::unpack_var()) { oops("Unable to create files inside the 'var' directory"); } else if (!installer::unpack_sql($config)) { -- cgit v1.2.3