r40771 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40770‎ | r40771 | r40772 >
Date:05:48, 13 September 2008
Author:krimpet
Status:old
Tags:
Comment:
#15577: Moved spreading of autoblocks from User::isBlocked() et al to ::setCookies() and (if the session doesn't exist, but token cookie does) ::loadFromSession(). Autoblocks will now be spread predictably at the beginning of a session, instead of at random points as a side effect of testing for blocks.
Modified paths:
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -834,6 +834,11 @@
835835 } else if ( isset( $_COOKIE["{$wgCookiePrefix}Token"] ) ) {
836836 $passwordCorrect = $this->mToken == $_COOKIE["{$wgCookiePrefix}Token"];
837837 $from = 'cookie';
 838+
 839+ if ( ( $sName == $this->mName ) && $passwordCorrect ) {
 840+ # New session from old cookie - spread any applicable autoblocks
 841+ $this->spreadBlock();
 842+ }
838843 } else {
839844 # No session or persistent login cookie
840845 $this->loadDefaults();
@@ -1049,9 +1054,6 @@
10501055 $this->mBlockedby = $this->mBlock->mBy;
10511056 $this->mBlockreason = $this->mBlock->mReason;
10521057 $this->mHideName = $this->mBlock->mHideName;
1053 - if ( $this->isLoggedIn() ) {
1054 - $this->spreadBlock();
1055 - }
10561058 } else {
10571059 $this->mBlock = null;
10581060 wfDebug( __METHOD__.": No block.\n" );
@@ -2236,6 +2238,9 @@
22372239 } else {
22382240 $cookies['Token'] = false;
22392241 }
 2242+
 2243+ # Spread any applicable autoblocks
 2244+ $this->spreadBlock();
22402245
22412246 wfRunHooks( 'UserSetCookies', array( $this, &$session, &$cookies ) );
22422247 $_SESSION = $session + $_SESSION;

Follow-up revisions

RevisionCommit summaryAuthorDate
r40842Reverted r40771 for now - causes problems with CentralAuthkrimpet05:04, 15 September 2008