mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 17:05:45 +02:00
ENHANCEMENT Added PostgreSQLDatabaseConfigurationHelper::getDatabaseVersion()
This commit is contained in:
parent
2c38c37bb2
commit
133e6ff6ec
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user