From: Daniel Friesen Date: Mon, 30 Jun 2008 05:16:38 +0000 (+0000) Subject: Some missing changes for the $wgShared(DB|Prefix|Tables) setup: X-Git-Tag: 1.31.0-rc.0~46840 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=48019ed5546c3acf9bbdef32314a2c0e2174365e;p=lhc%2Fweb%2Fwiklou.git Some missing changes for the $wgShared(DB|Prefix|Tables) setup: * $wgCookiePrefix: ** Shared stuff should always come before local stuff when setting the cookie prefix (by my count, if you set $wgSharedDB and $wgDBprefix with the old order, even though your usertable is shared, your cookies would be local and logins wouldn't be shared right. ** Because the user table isn't always shared anymore, we only want shared code when $wgSharedTables has 'user' set inside of it. ** We now have $wgSharedPrefix, this should also be accounted for in the cookie prefix. * updaders.inc: The logic for the $doUser test has changed since the conditions that the user table is shared has changed. Now when $shared is true we only want to $doUser when we have a shared database and 'user' is being shared, otherwise if $shared is false, we only want to $doUser when there is no shared database, or 'user' is not being shared. Check MediaWiki.org's $wgSharedDB documentation for those on 1.12, I'll post a link there to a patch I maintain for 1.12. --- diff --git a/includes/Setup.php b/includes/Setup.php index 2e0f15bdb8..61b31739ad 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -204,10 +204,12 @@ wfProfileIn( $fname.'-SetupSession' ); # Set default shared prefix if( $wgSharedPrefix === false ) $wgSharedPrefix = $wgDBprefix; -if ( $wgDBprefix ) { - $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix; -} elseif ( $wgSharedDB ) { +if ( in_array('user', $wgSharedTables) && $wgSharedDB && $wgSharedPrefix ) { + $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix; +} elseif ( in_array('user', $wgSharedTables) && $wgSharedDB ) { $wgCookiePrefix = $wgSharedDB; +} elseif ( $wgDBprefix ) { + $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix; } else { $wgCookiePrefix = $wgDBname; } diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index c83893b2dc..a882dae46f 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1034,11 +1034,11 @@ function purge_cache() { } function do_all_updates( $shared = false, $purge = true ) { - global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgDatabase, $wgDBtype, $IP; + global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgSharedTables, $wgDatabase, $wgDBtype, $IP; wfRunHooks('LoadExtensionSchemaUpdates'); - $doUser = !$wgSharedDB || $shared; + $doUser = $shared ? $wgSharedDB && in_array('user', $wgSharedTables) : !$wgSharedDB || !in_array('user', $wgSharedTables); if ($wgDBtype === 'postgres') { do_postgres_updates();