Some missing changes for the $wgShared(DB|Prefix|Tables) setup:
authorDaniel Friesen <dantman@users.mediawiki.org>
Mon, 30 Jun 2008 05:16:38 +0000 (05:16 +0000)
committerDaniel Friesen <dantman@users.mediawiki.org>
Mon, 30 Jun 2008 05:16:38 +0000 (05:16 +0000)
* $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.

includes/Setup.php
maintenance/updaters.inc

index 2e0f15b..61b3173 100644 (file)
@@ -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;
 }
index c83893b..a882dae 100644 (file)
@@ -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();