diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-08-28 15:17:07 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-08-28 15:17:07 -0700 |
commit | 1ce8643b8056266139552045fcdb48bbdb9c665b (patch) | |
tree | 9825e22add088ebffd14b592e5ab29afb52867c1 | |
parent | 31d63a0d0a27212435a78eb38461320f486b5f95 (diff) |
Fix for #440. Basically add a check that the mysql version is > 5.0.0.
It was felt that actually listing the requirements might be overwhelming
to novice users.
-rw-r--r-- | installer/installer.php | 7 | ||||
-rw-r--r-- | installer/views/invalid_db_version.html.php | 5 | ||||
-rw-r--r-- | installer/web.php | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/installer/installer.php b/installer/installer.php index b0af561e..456cffaa 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -104,6 +104,13 @@ class installer { mysql_select_db($config["dbname"]); } + static function verify_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", ">="); + } + static function db_empty($config) { $query = "SHOW TABLES IN {$config['dbname']} LIKE '{$config['prefix']}items'"; return mysql_num_rows(mysql_query($query)) == 0; diff --git a/installer/views/invalid_db_version.html.php b/installer/views/invalid_db_version.html.php new file mode 100644 index 00000000..8776ac35 --- /dev/null +++ b/installer/views/invalid_db_version.html.php @@ -0,0 +1,5 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<h1> Uh oh! </h1> +<p class="error"> + The MySql database that you are referencing is less than the minimum version of 5.0.0. +</p> diff --git a/installer/web.php b/installer/web.php index f31c0644..aceb5368 100644 --- a/installer/web.php +++ b/installer/web.php @@ -41,6 +41,8 @@ if (installer::already_installed()) { if (!installer::connect($config)) { $content = render("invalid_db_info.html.php"); + } else if (!installer::verify_version($config)) { + $content = render("invalid_db_version.html.php"); } else if (!installer::select_db($config)) { $content = render("missing_db.html.php"); } else if (!installer::db_empty($config)) { |