From e8031547af6d0a662d6c12e3b629d946dd1a16d6 Mon Sep 17 00:00:00 2001 From: Platonides Date: Thu, 15 Dec 2011 21:21:30 +0000 Subject: [PATCH] Simplify a bit the code of r106025 --- includes/db/DatabasePostgres.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index aa0b8ab69e..852ea2fb19 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -642,11 +642,13 @@ class DatabasePostgres extends DatabaseBase { # Split database and table into proper variables. # We reverse the explode so that schema.table and table both output # the correct table. - $dbDetails = array_reverse( explode( '.', $name, 2 ) ); + $dbDetails = explode( '.', $name, 2 ); if ( isset( $dbDetails[1] ) ) { - list( $table, $schema ) = $dbDetails; + $schema = '"' . $dbDetails[0] . '".'; + $table = $dbDetails [1]; } else { - list( $table ) = $dbDetails; + $schema = "\"{$wgDBmwschema}\"."; # keep old schema, but quote it. + $table = $dbDetails[0]; } if ( $format != 'quoted' ) { switch( $name ) { @@ -658,12 +660,7 @@ class DatabasePostgres extends DatabaseBase { return $table; } } - if ( !isset( $schema )) { - $schema = "\"{$wgDBmwschema}\"."; - } else { - # keep old schema, but quote it. - $schema = "\"{$schema}\"."; - } + # during installation wgDBmwschema is not set, so we would end up quering # ""."table" => error. Erase the first part if wgDBmwschema is empty if ( $schema == "\"\"." ) { -- 2.20.1