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
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getDatabaseVersion($databaseConfig) {
|
||||||
* Ensure that the PostgreSQL version is at least 8.3.
|
$version = 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) {
|
|
||||||
$success = false;
|
|
||||||
$error = '';
|
|
||||||
|
|
||||||
$username = $databaseConfig['username'] ? $databaseConfig['username'] : '';
|
$username = $databaseConfig['username'] ? $databaseConfig['username'] : '';
|
||||||
$password = $databaseConfig['password'] ? $databaseConfig['password'] : '';
|
$password = $databaseConfig['password'] ? $databaseConfig['password'] : '';
|
||||||
$server = $databaseConfig['server'];
|
$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) {
|
if($version) {
|
||||||
$success = version_compare($version, '8.3', '>=');
|
$success = version_compare($version, '8.3', '>=');
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
|
Loading…
Reference in New Issue
Block a user