r36802 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36801‎ | r36802 | r36803 >
Date:05:16, 30 June 2008
Author:dantman
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updaters.inc
@@ -1034,11 +1034,11 @@
10351035 }
10361036
10371037 function do_all_updates( $shared = false, $purge = true ) {
1038 - global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgDatabase, $wgDBtype, $IP;
 1038+ global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgSharedTables, $wgDatabase, $wgDBtype, $IP;
10391039
10401040 wfRunHooks('LoadExtensionSchemaUpdates');
10411041
1042 - $doUser = !$wgSharedDB || $shared;
 1042+ $doUser = $shared ? $wgSharedDB && in_array('user', $wgSharedTables) : !$wgSharedDB || !in_array('user', $wgSharedTables);
10431043
10441044 if ($wgDBtype === 'postgres') {
10451045 do_postgres_updates();
Index: trunk/phase3/includes/Setup.php
@@ -204,10 +204,12 @@
205205 # Set default shared prefix
206206 if( $wgSharedPrefix === false ) $wgSharedPrefix = $wgDBprefix;
207207
208 -if ( $wgDBprefix ) {
 208+if ( in_array('user', $wgSharedTables) && $wgSharedDB && $wgSharedPrefix ) {
 209+ $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
 210+} elseif ( in_array('user', $wgSharedTables) && $wgSharedDB ) {
 211+ $wgCookiePrefix = $wgSharedDB;
 212+} elseif ( $wgDBprefix ) {
209213 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
210 -} elseif ( $wgSharedDB ) {
211 - $wgCookiePrefix = $wgSharedDB;
212214 } else {
213215 $wgCookiePrefix = $wgDBname;
214216 }

Status & tagging log