ENHANCEMENT Added PostgreSQLDatabaseConfigurationHelper::getDatabaseVersion()

This commit is contained in:
Sean Harvey 2010-05-26 05:14:05 +00:00
parent 2c38c37bb2
commit 133e6ff6ec

View File

@ -80,15 +80,8 @@ class PostgreSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelp
);
}
/**
* Ensure that the PostgreSQL version is at least 8.3.
* @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) {
$success = false;
$error = '';
public function getDatabaseVersion($databaseConfig) {
$version = 0;
$username = $databaseConfig['username'] ? $databaseConfig['username'] : '';
$password = $databaseConfig['password'] ? $databaseConfig['password'] : '';
$server = $databaseConfig['server'];
@ -110,6 +103,19 @@ class PostgreSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelp
}
}
return $version;
}
/**
* Ensure that the PostgreSQL version is at least 8.3.
* @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) {
$success = false;
$error = '';
$version = $this->getDatabaseVersion($databaseConfig);
if($version) {
$success = version_compare($version, '8.3', '>=');
if(!$success) {