From fd954fe86e2852c245dd599f9476fdf8ea3642e4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 13:43:29 -0700 Subject: Print out the version of MySQL that we found along with our error message, which should resolve http://gallery.menalto.com/node/90646 --- installer/installer.php | 8 ++++++-- installer/views/invalid_db_version.html.php | 2 +- installer/web.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'installer') diff --git a/installer/installer.php b/installer/installer.php index 456cffaa..58d264ec 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -104,11 +104,15 @@ class installer { mysql_select_db($config["dbname"]); } - static function verify_version($config) { + static function verify_mysql_version($config) { + return version_compare(installer::mysql_version($config), "5.0.0", ">="); + } + + static function mysql_version($config) { $result = mysql_query("SHOW VARIABLES WHERE variable_name = \"version\""); $row = mysql_fetch_object($result); $version = substr($row->Value, 0, strpos($row->Value, "-")); - return version_compare($version, "5.0.0", ">="); + return $version; } static function db_empty($config) { diff --git a/installer/views/invalid_db_version.html.php b/installer/views/invalid_db_version.html.php index 8776ac35..5b021ba2 100644 --- a/installer/views/invalid_db_version.html.php +++ b/installer/views/invalid_db_version.html.php @@ -1,5 +1,5 @@

Uh oh!

- The MySql database that you are referencing is less than the minimum version of 5.0.0. + Gallery requires at least MySQL version 5.0.0. You're using version

diff --git a/installer/web.php b/installer/web.php index aceb5368..eb0211a6 100644 --- a/installer/web.php +++ b/installer/web.php @@ -41,7 +41,7 @@ if (installer::already_installed()) { if (!installer::connect($config)) { $content = render("invalid_db_info.html.php"); - } else if (!installer::verify_version($config)) { + } else if (!installer::verify_mysql_version($config)) { $content = render("invalid_db_version.html.php"); } else if (!installer::select_db($config)) { $content = render("missing_db.html.php"); -- cgit v1.2.3 From 31dcdcc6ad6ce47c03265f3d6e499774a17ff727 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 15:18:20 -0700 Subject: Remove unnecessary cleverness in stripping off the hyphen for mysql version checks that was causing problems in the case where there's no hyphen. version_compare handles hypens fine. --- installer/installer.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'installer') diff --git a/installer/installer.php b/installer/installer.php index 58d264ec..50657d80 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -110,9 +110,7 @@ class installer { static function mysql_version($config) { $result = mysql_query("SHOW VARIABLES WHERE variable_name = \"version\""); - $row = mysql_fetch_object($result); - $version = substr($row->Value, 0, strpos($row->Value, "-")); - return $version; + return $row->Value; } static function db_empty($config) { -- cgit v1.2.3