Index: trunk/phase3/includes/search/SearchPostgres.php |
— | — | @@ -134,13 +134,9 @@ |
135 | 135 | * @param $colname |
136 | 136 | */ |
137 | 137 | function searchQuery( $term, $fulltext, $colname ) { |
138 | | - global $wgDBversion; |
| 138 | + $postgresVersion = $this->db->getServerVersion(); |
139 | 139 | |
140 | | - if ( !isset( $wgDBversion ) ) { |
141 | | - $this->db->getServerVersion(); |
142 | | - $wgDBversion = $this->db->numeric_version; |
143 | | - } |
144 | | - $prefix = $wgDBversion < 8.3 ? "'default'," : ''; |
| 140 | + $prefix = $postgresVersion < 8.3 ? "'default'," : ''; |
145 | 141 | |
146 | 142 | # Get the SQL fragment for the given term |
147 | 143 | $searchstring = $this->parseQuery( $term ); |
— | — | @@ -167,8 +163,8 @@ |
168 | 164 | } |
169 | 165 | } |
170 | 166 | |
171 | | - $rankscore = $wgDBversion > 8.2 ? 5 : 1; |
172 | | - $rank = $wgDBversion < 8.3 ? 'rank' : 'ts_rank'; |
| 167 | + $rankscore = $postgresVersion > 8.2 ? 5 : 1; |
| 168 | + $rank = $postgresVersion < 8.3 ? 'rank' : 'ts_rank'; |
173 | 169 | $query = "SELECT page_id, page_namespace, page_title, ". |
174 | 170 | "$rank($fulltext, to_tsquery($prefix $searchstring), $rankscore) AS score ". |
175 | 171 | "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " . |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -777,15 +777,13 @@ |
778 | 778 | * @return bool Success of insert operation. IGNORE always returns true. |
779 | 779 | */ |
780 | 780 | function insert( $table, $args, $fname = 'DatabasePostgres::insert', $options = array() ) { |
781 | | - global $wgDBversion; |
782 | | - |
783 | 781 | if ( !count( $args ) ) { |
784 | 782 | return true; |
785 | 783 | } |
786 | 784 | |
787 | 785 | $table = $this->tableName( $table ); |
788 | | - if (! isset( $wgDBversion ) ) { |
789 | | - $wgDBversion = $this->getServerVersion(); |
| 786 | + if (! isset( $this->numeric_version ) ) { |
| 787 | + $this->getServerVersion(); |
790 | 788 | } |
791 | 789 | |
792 | 790 | if ( !is_array( $options ) ) |
— | — | @@ -819,7 +817,7 @@ |
820 | 818 | $sql = "INSERT INTO $table (" . implode( ',', $keys ) . ') VALUES '; |
821 | 819 | |
822 | 820 | if ( $multi ) { |
823 | | - if ( $wgDBversion >= 8.2 && !$ignore ) { |
| 821 | + if ( $this->numeric_version >= 8.2 && !$ignore ) { |
824 | 822 | $first = true; |
825 | 823 | foreach ( $args as $row ) { |
826 | 824 | if ( $first ) { |
— | — | @@ -1156,16 +1154,18 @@ |
1157 | 1155 | * @return string Version information from the database |
1158 | 1156 | */ |
1159 | 1157 | function getServerVersion() { |
1160 | | - $versionInfo = pg_version( $this->mConn ); |
1161 | | - if ( version_compare( $versionInfo['client'], '7.4.0', 'lt' ) ) { |
1162 | | - // Old client, abort install |
1163 | | - $this->numeric_version = '7.3 or earlier'; |
1164 | | - } elseif ( isset( $versionInfo['server'] ) ) { |
1165 | | - // Normal client |
1166 | | - $this->numeric_version = $versionInfo['server']; |
1167 | | - } else { |
1168 | | - // Bug 16937: broken pgsql extension from PHP<5.3 |
1169 | | - $this->numeric_version = pg_parameter_status( $this->mConn, 'server_version' ); |
| 1158 | + if ( ! isset( this->numeric_version ) ) { |
| 1159 | + $versionInfo = pg_version( $this->mConn ); |
| 1160 | + if ( version_compare( $versionInfo['client'], '7.4.0', 'lt' ) ) { |
| 1161 | + // Old client, abort install |
| 1162 | + $this->numeric_version = '7.3 or earlier'; |
| 1163 | + } elseif ( isset( $versionInfo['server'] ) ) { |
| 1164 | + // Normal client |
| 1165 | + $this->numeric_version = $versionInfo['server']; |
| 1166 | + } else { |
| 1167 | + // Bug 16937: broken pgsql extension from PHP<5.3 |
| 1168 | + $this->numeric_version = pg_parameter_status( $this->mConn, 'server_version' ); |
| 1169 | + } |
1170 | 1170 | } |
1171 | 1171 | return $this->numeric_version; |
1172 | 1172 | } |