mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 17:05:45 +02:00
BUGFIX Fixed border case where pg_version() could return false and break functionality in PostgreSQLDatabaseConfigurationHelper::requireDatabaseVersion()
This commit is contained in:
parent
5f17db6599
commit
2c38c37bb2
@ -88,7 +88,6 @@ class PostgreSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelp
|
||||
public function requireDatabaseVersion($databaseConfig) {
|
||||
$success = false;
|
||||
$error = '';
|
||||
$version = 0;
|
||||
|
||||
$username = $databaseConfig['username'] ? $databaseConfig['username'] : '';
|
||||
$password = $databaseConfig['password'] ? $databaseConfig['password'] : '';
|
||||
@ -97,9 +96,8 @@ class PostgreSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelp
|
||||
$passwordPart = $password ? " password=$password" : '';
|
||||
$connstring = "host=$server port=5432 dbname=postgres {$userPart}{$passwordPart}";
|
||||
$conn = @pg_connect($connstring);
|
||||
|
||||
$versionInfo = pg_version($conn);
|
||||
$version = isset($versionInfo['server']) ? $versionInfo['server'] : null;
|
||||
$info = @pg_version($conn);
|
||||
$version = ($info && isset($info['server'])) ? $info['server'] : null;
|
||||
if(!$version) {
|
||||
// fallback to using the version() function
|
||||
$result = @pg_query($conn, "SELECT version()");
|
||||
|
Loading…
Reference in New Issue
Block a user