ENHANCEMENT Added MySQLDatabaseConfigurationHelper::getDatabaseVersion() which abstracts the version number away from the version check the installer requires

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@105712 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-05-26 05:09:10 +00:00 committed by Sam Minnee
parent 003d43f3ac
commit 83a433894a

View File

@ -42,14 +42,18 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper {
);
}
public function getDatabaseVersion($databaseConfig) {
$conn = @mysql_connect($databaseConfig['server'], null, null);
return @mysql_get_server_info($conn);
}
/**
* Ensure that the MySQL server version is at least 5.0.
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
* @return array Result - e.g. array('success' => true, 'error' => 'details of error')
*/
public function requireDatabaseVersion($databaseConfig) {
$conn = @mysql_connect($databaseConfig['server'], null, null);
$version = @mysql_get_server_info($conn);
$version = $this->getDatabaseVersion($databaseConfig);
$success = false;
$error = '';
if($version) {