r25296 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25295‎ | r25296 | r25297 >
Date:21:39, 29 August 2007
Author:brion
Status:old
Tags:
Comment:
Forbid blocked accounts from winning the automatic home-wiki selection
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuthUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/CentralAuthUser.php
@@ -333,6 +333,15 @@
334334 $workingSet = $migrationSet;
335335 }
336336
 337+ // Blocked accounts not allowed to get automatic home wiki
 338+ foreach( $workingSet as $db => $local ) {
 339+ if( $local['blocked'] ) {
 340+ wfDebugLog( 'CentralAuth',
 341+ "Striking blocked account $this->mName@$db from working set\n" );
 342+ unset( $workingSet[$db] );
 343+ }
 344+ }
 345+
337346 $maxEdits = -1;
338347 $homeWiki = null;
339348 foreach( $workingSet as $db => $local ) {
@@ -975,7 +984,8 @@
976985 'emailAuthenticated' => $row->user_email_authenticated,
977986 'password' => $row->user_password,
978987 'editCount' => $row->user_editcount,
979 - 'groups' => array() );
 988+ 'groups' => array(),
 989+ 'blocked' => array() );
980990
981991 // Edit count field may not be initialized...
982992 if( is_null( $row->user_editcount ) ) {
@@ -997,6 +1007,19 @@
9981008 }
9991009 $result->free();
10001010
 1011+ // And while we're in here, look for user blocks :D
 1012+ $blocks = array();
 1013+ $result = $db->select( "`$dbname`.ipblocks",
 1014+ array( 'ipb_expiry' ),
 1015+ array( 'ipb_user' => $data['id'] ),
 1016+ __METHOD__ );
 1017+ foreach( $result as $row ) {
 1018+ if( Block::decodeExpiry( $row->ipb_expiry ) > wfTimestampNow() ) {
 1019+ $data['blocked'] = true;
 1020+ }
 1021+ }
 1022+ $result->free();
 1023+
10011024 return $data;
10021025 }
10031026

Status & tagging log