From 1caee6915bd21a1e5c4b06763872da8776b6cd33 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 11 May 2009 11:35:52 +0000 Subject: [PATCH] Proposed fix for bug 16937: pg_version() missing server version due to PHP bug. --- includes/db/DatabasePostgres.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index bc16bdbc56..c940ad095f 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -1076,12 +1076,15 @@ class DatabasePostgres extends Database { */ function getServerVersion() { $versionInfo = pg_version( $this->mConn ); - if ( isset( $versionInfo['server'] ) ) { + if ( version_compare( $versionInfo['client'], '7.4.0', 'lt' ) ) { + // Old client, abort install + $this->numeric_version = '7.3 or earlier'; + } elseif ( isset( $versionInfo['server'] ) ) { + // Normal client $this->numeric_version = $versionInfo['server']; } else { - // There's no way to identify the precise version before 7.4, but - // it doesn't matter anyway since we're just going to give an error. - $this->numeric_version = '7.3 or earlier'; + // Bug 16937: broken pgsql extension from PHP<5.3 + $this->numeric_version = pg_parameter_status( $this->mConn, 'server_version' ); } return $this->numeric_version; } -- 2.20.1