summaryrefslogtreecommitdiff
path: root/maintenance/updaters.inc
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-07-18 09:49:48 +0200
committerPierre Schmitz <pierre@archlinux.de>2007-07-18 09:49:48 +0200
commitfd12989ef8eab0fc9816decb8bcabccd1d213ee8 (patch)
tree68b12cc05704f2181a90d69b898f999309a8c036 /maintenance/updaters.inc
parent1a1c15f5da352895fb32daab8550cb3dca8198ac (diff)
auf 1.10.1 aktualisiert
Diffstat (limited to 'maintenance/updaters.inc')
-rw-r--r--maintenance/updaters.inc38
1 files changed, 36 insertions, 2 deletions
diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc
index b3fb16f4..023a6b4b 100644
--- a/maintenance/updaters.inc
+++ b/maintenance/updaters.inc
@@ -1159,7 +1159,7 @@ END;
}
function do_postgres_updates() {
- global $wgDatabase, $wgVersion, $wgDBmwschema, $wgShowExceptionDetails;
+ global $wgDatabase, $wgVersion, $wgDBmwschema, $wgDBts2schema, $wgShowExceptionDetails, $wgDBuser;
$wgShowExceptionDetails = 1;
@@ -1167,6 +1167,41 @@ function do_postgres_updates() {
if ( !isset( $wgDBmwschema ))
$wgDBmwschema = 'mediawiki';
+ # Verify that this user is configured correctly
+ $safeuser = $wgDatabase->addQuotes($wgDBuser);
+ $SQL = "SELECT array_to_string(useconfig,'*') FROM pg_user WHERE usename = $safeuser";
+ $config = pg_fetch_result( $wgDatabase->doQuery( $SQL ), 0, 0 );
+ $conf = array();
+ foreach( explode( '*', $config ) as $c ) {
+ list( $x,$y ) = explode( '=', $c );
+ $conf[$x] = $y;
+ }
+ $newpath = array();
+ if( !array_key_exists( 'search_path', $conf ) or strpos( $conf['search_path'],$wgDBmwschema ) === false ) {
+ print "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n";
+ $newpath[$wgDBmwschema] = 1;
+ }
+ if( !array_key_exists( 'search_path', $conf ) or strpos( $conf['search_path'],$wgDBts2schema ) === false ) {
+ print "Adding in schema \"$wgDBts2schema\" to search_path for user \"$wgDBuser\"\n";
+ $newpath[$wgDBts2schema] = 1;
+ }
+ $searchpath = implode( ',', array_keys( $newpath ) );
+ if( strlen( $searchpath ) ) {
+ $wgDatabase->doQuery( "ALTER USER $wgDBuser SET search_path = $searchpath" );
+ }
+ $goodconf = array(
+ 'client_min_messages' => 'error',
+ 'DateStyle' => 'ISO, YMD',
+ 'TimeZone' => 'GMT'
+ );
+ foreach( array_keys( $goodconf ) AS $key ) {
+ $value = $goodconf[$key];
+ if( !array_key_exists( $key, $conf ) or $conf[$key] !== $value ) {
+ print "Setting $key to '$value' for user \"$wgDBuser\"\n";
+ $wgDatabase->doQuery( "ALTER USER $wgDBuser SET $key = '$value'" );
+ }
+ }
+
$newsequences = array(
"log_log_id_seq",
"pr_id_val",
@@ -1227,7 +1262,6 @@ function do_postgres_updates() {
$newrules = array(
);
-
foreach ($newsequences as $ns) {
if ($wgDatabase->sequenceExists($ns)) {
echo "... sequence $ns already exists\n";