r56325 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56324‎ | r56325 | r56326 >
Date:19:34, 14 September 2009
Author:churchofemacs
Status:ok
Tags:
Comment:
Fixing User::getBlockedStatus which broke r55918. Function now works for all user objects, not just wgUser
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -1066,7 +1066,7 @@
10671067 * done against master.
10681068 */
10691069 function getBlockedStatus( $bFromSlave = true ) {
1070 - global $wgEnableSorbs, $wgProxyWhitelist;
 1070+ global $wgEnableSorbs, $wgProxyWhitelist, $wgUser;
10711071
10721072 if ( -1 != $this->mBlockedby ) {
10731073 wfDebug( "User::getBlockedStatus: already loaded.\n" );
@@ -1086,9 +1086,25 @@
10871087 $this->mBlockedby = 0;
10881088 $this->mHideName = 0;
10891089 $this->mAllowUsertalk = 0;
1090 - $ip = wfGetIP();
10911090
1092 - if ($this->isAllowed( 'ipblock-exempt' ) ) {
 1091+ # Check if we are looking at an IP or a logged-in user
 1092+ if ( $this->isIP( $this->getName() ) ) {
 1093+ $ip = $this->getName();
 1094+ }
 1095+ else {
 1096+ # Check if we are looking at the current user
 1097+ # If we don't, and the user is logged in, we don't know about
 1098+ # his IP / autoblock status, so ignore autoblock of current user's IP
 1099+ if ( $this->getID() != $wgUser->getID() ) {
 1100+ $ip = '';
 1101+ }
 1102+ else {
 1103+ # Get IP of current user
 1104+ $ip = wfGetIP();
 1105+ }
 1106+ }
 1107+
 1108+ if ( $this->isAllowed( 'ipblock-exempt' ) ) {
10931109 # Exempt from all types of IP-block
10941110 $ip = '';
10951111 }
Index: trunk/phase3/RELEASE-NOTES
@@ -500,6 +500,8 @@
501501 * (bug 20634) The installer-created database user will now have all rights on
502502 the database so that upgrades will go more smoothly.
503503 * (bug 18180) Special:Export ignores limit, dir, offset parameters
 504+* User::getBlockedStatus() works for all kinds of user objects and doesn't
 505+ assume the user object is equal to the current-user object ($wgUser)
504506
505507 == API changes in 1.16 ==
506508

Follow-up revisions

RevisionCommit summaryAuthorDate
r56381Merge r56325 from trunkbrion18:16, 15 September 2009
r56471Fix bug where checking another user's blocked status (like for contributions)...werdna00:56, 17 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r55918fixing r55909: checking if the user is _currently_ blocked before displaying ...churchofemacs12:04, 7 September 2009

Status & tagging log