r100492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100491‎ | r100492 | r100493 >
Date:02:40, 22 October 2011
Author:reedy
Status:ok
Tags:
Comment:
MFT r99323, r99349m r99630
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/includes (modified) (history)
  • /branches/REL1_18/phase3/includes/EditPage.php (modified) (history)
  • /branches/REL1_18/phase3/includes/Title.php (modified) (history)
  • /branches/REL1_18/phase3/includes/User.php (modified) (history)
  • /branches/REL1_18/phase3/includes/specials (modified) (history)
  • /branches/REL1_18/phase3/includes/specials/SpecialMovepage.php (modified) (history)
  • /branches/REL1_18/phase3/languages (modified) (history)
  • /branches/REL1_18/phase3/languages/messages (modified) (history)
  • /branches/REL1_18/phase3/languages/messages/MessagesGl.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/User.php
@@ -1274,9 +1274,6 @@
12751275 $this->mBlockreason = $this->mBlock->mReason;
12761276 $this->mHideName = $this->mBlock->mHideName;
12771277 $this->mAllowUsertalk = !$this->mBlock->prevents( 'editownusertalk' );
1278 - if ( $this->isLoggedIn() && $wgUser->getID() == $this->getID() ) {
1279 - $this->spreadBlock();
1280 - }
12811278 }
12821279
12831280 # Proxy blocking
@@ -2906,22 +2903,35 @@
29072904 }
29082905
29092906 /**
2910 - * If this (non-anonymous) user is blocked, block any IP address
2911 - * they've successfully logged in from.
 2907+ * If this user is logged-in and blocked,
 2908+ * block any IP address they've successfully logged in from.
 2909+ * @return bool A block was spread
29122910 */
2913 - public function spreadBlock() {
 2911+ public function spreadAnyEditBlock() {
 2912+ if ( $this->isLoggedIn() && $this->isBlocked() ) {
 2913+ return $this->spreadBlock();
 2914+ }
 2915+ return false;
 2916+ }
 2917+
 2918+ /**
 2919+ * If this (non-anonymous) user is blocked,
 2920+ * block the IP address they've successfully logged in from.
 2921+ * @return bool A block was spread
 2922+ */
 2923+ protected function spreadBlock() {
29142924 wfDebug( __METHOD__ . "()\n" );
29152925 $this->load();
29162926 if ( $this->mId == 0 ) {
2917 - return;
 2927+ return false;
29182928 }
29192929
29202930 $userblock = Block::newFromTarget( $this->getName() );
29212931 if ( !$userblock ) {
2922 - return;
 2932+ return false;
29232933 }
29242934
2925 - $userblock->doAutoblock( wfGetIP() );
 2935+ return (bool)$userblock->doAutoblock( $this->getRequest()->getIP() );
29262936 }
29272937
29282938 /**
Index: branches/REL1_18/phase3/includes/EditPage.php
@@ -402,6 +402,9 @@
403403
404404 $permErrors = $this->getEditPermissionErrors();
405405 if ( $permErrors ) {
 406+ // Auto-block user's IP if the account was "hard" blocked
 407+ $wgUser->spreadAnyEditBlock();
 408+
406409 wfDebug( __METHOD__ . ": User can't edit\n" );
407410 $content = $this->getContent( null );
408411 $content = $content === '' ? null : $content;
@@ -934,6 +937,8 @@
935938 return $status;
936939 }
937940 if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
 941+ // Auto-block user's IP if the account was "hard" blocked
 942+ $wgUser->spreadAnyEditBlock();
938943 # Check block state against master, thus 'false'.
939944 $status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER );
940945 wfProfileOut( __METHOD__ . '-checks' );
Property changes on: branches/REL1_18/phase3/includes/EditPage.php
___________________________________________________________________
Modified: svn:mergeinfo
941946 Merged /trunk/phase3/includes/EditPage.php:r99323,99349,99630
Index: branches/REL1_18/phase3/includes/Title.php
@@ -3139,8 +3139,11 @@
31403140 * @return Mixed true on success, getUserPermissionsErrors()-like array on failure
31413141 */
31423142 public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) {
 3143+ global $wgUser;
31433144 $err = $this->isValidMoveOperation( $nt, $auth, $reason );
31443145 if ( is_array( $err ) ) {
 3146+ // Auto-block user's IP if the account was "hard" blocked
 3147+ $wgUser->spreadAnyEditBlock();
31453148 return $err;
31463149 }
31473150
Property changes on: branches/REL1_18/phase3/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
31483151 Merged /trunk/phase3/includes/Title.php:r99349,99630
Index: branches/REL1_18/phase3/includes/specials/SpecialMovepage.php
@@ -74,7 +74,9 @@
7575 # Check rights
7676 $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $wgUser );
7777 if( !empty( $permErrors ) ) {
78 - $wgOut->showPermissionsErrorPage( $permErrors );
 78+ // Auto-block user's IP if the account was "hard" blocked
 79+ $user->spreadAnyEditBlock();
 80+ $this->getOutput()->showPermissionsErrorPage( $permErrors );
7981 return;
8082 }
8183
Property changes on: branches/REL1_18/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
8284 Merged /trunk/phase3/includes/specials:r99323,99349,99630
Property changes on: branches/REL1_18/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
8385 Merged /trunk/phase3/includes:r99323,99349,99630
Index: branches/REL1_18/phase3/languages/messages/MessagesGl.php
@@ -46,6 +46,11 @@
4747 'Conversa_Categoría' => NS_CATEGORY_TALK,
4848 );
4949
 50+$namespaceGenderAliases = array(
 51+ NS_USER => array( 'male' => 'Usuario', 'female' => 'Usuaria' ),
 52+ NS_USER_TALK => array( 'male' => 'Conversa_usuario', 'female' => 'Conversa_usuaria' ),
 53+);
 54+
5055 $defaultDateFormat = 'dmy';
5156
5257 $dateFormats = array(
Property changes on: branches/REL1_18/phase3/languages/messages
___________________________________________________________________
Modified: svn:mergeinfo
5358 Merged /trunk/phase3/languages/messages:r99630
Property changes on: branches/REL1_18/phase3/languages
___________________________________________________________________
Modified: svn:mergeinfo
5459 Merged /trunk/phase3/languages:r99630
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
5560 Merged /trunk/phase3:r99323,99349,99630

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99323* Only spread blocks on page edit/move attempts via spreadAnyEditBlock(). We ...aaron20:22, 8 October 2011
r99630namespaceGenderAliases for gl...nikerabbit13:05, 12 October 2011

Status & tagging log