Property changes on: branches/REL1_15/phase3/includes/api |
___________________________________________________________________ |
Name: svn:mergeinfo |
1 | 1 | - /trunk/phase3/includes/api:48813-48814,48819,48836,48909,48989,48992,49051,49068,49086,49682,49775 |
2 | 2 | + /trunk/phase3/includes/api:48813-48814,48819,48836,48886,48892,48909,48989,48992,49051,49068,49086,49191-49192,49682,49685,49730,49775,50070 |
Index: branches/REL1_15/phase3/includes/specials/SpecialIpblocklist.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | * @return array array(message key, parameters) on failure, empty array on success |
164 | 164 | */ |
165 | 165 | |
166 | | - static function doUnblock(&$id, &$ip, &$reason, &$range = null) { |
| 166 | + static function doUnblock(&$id, &$ip, &$reason, &$range = null, $blocker=null) { |
167 | 167 | if ( $id ) { |
168 | 168 | $block = Block::newFromID( $id ); |
169 | 169 | if ( !$block ) { |
— | — | @@ -195,11 +195,22 @@ |
196 | 196 | } |
197 | 197 | // Yes, this is really necessary |
198 | 198 | $id = $block->mId; |
| 199 | + |
| 200 | + # If the name was hidden and the blocking user cannot hide |
| 201 | + # names, then don't allow any block removals... |
| 202 | + if( $blocker && $block->mHideName && !$blocker->isAllowed('hideuser') ) { |
| 203 | + return array('ipb_cant_unblock', htmlspecialchars($id)); |
| 204 | + } |
199 | 205 | |
200 | 206 | # Delete block |
201 | 207 | if ( !$block->delete() ) { |
202 | 208 | return array('ipb_cant_unblock', htmlspecialchars($id)); |
203 | 209 | } |
| 210 | + |
| 211 | + # Unset _deleted fields as needed |
| 212 | + if( $block->mHideName ) { |
| 213 | + IPBlockForm::unsuppressUserName( $block->mAddress, $block->mUser ); |
| 214 | + } |
204 | 215 | |
205 | 216 | # Make log entry |
206 | 217 | $log = new LogPage( 'block' ); |
— | — | @@ -208,8 +219,8 @@ |
209 | 220 | } |
210 | 221 | |
211 | 222 | function doSubmit() { |
212 | | - global $wgOut; |
213 | | - $retval = self::doUnblock($this->id, $this->ip, $this->reason, $range); |
| 223 | + global $wgOut, $wgUser; |
| 224 | + $retval = self::doUnblock($this->id, $this->ip, $this->reason, $range, $wgUser); |
214 | 225 | if(!empty($retval)) |
215 | 226 | { |
216 | 227 | $key = array_shift($retval); |
Index: branches/REL1_15/phase3/includes/specials/SpecialBlockip.php |
— | — | @@ -45,6 +45,8 @@ |
46 | 46 | class IPBlockForm { |
47 | 47 | var $BlockAddress, $BlockExpiry, $BlockReason; |
48 | 48 | # var $BlockEmail; |
| 49 | + // The maximum number of edits a user can have and still be hidden |
| 50 | + const HIDEUSER_CONTRIBLIMIT = 1000; |
49 | 51 | |
50 | 52 | function IPBlockForm( $par ) { |
51 | 53 | global $wgRequest, $wgUser, $wgBlockAllowsUTEdit; |
— | — | @@ -401,7 +403,7 @@ |
402 | 404 | } else if( $expiry !== 'infinity' ) { |
403 | 405 | // Bad expiry. |
404 | 406 | return array('ipb_expiry_temp'); |
405 | | - } else if( User::edits($userId) > 3000 ) { |
| 407 | + } else if( User::edits($userId) > self::HIDEUSER_CONTRIBLIMIT ) { |
406 | 408 | // Typically, the user should have a handful of edits. |
407 | 409 | // Disallow hiding users with many edits for performance. |
408 | 410 | return array('ipb_hide_invalid'); |
— | — | @@ -444,7 +446,7 @@ |
445 | 447 | $log_action = 'reblock'; |
446 | 448 | # Unset _deleted fields if requested |
447 | 449 | if( $currentBlock->mHideName && !$this->BlockHideName ) { |
448 | | - $this->unsuppressUserName( $this->BlockAddress, $userId ); |
| 450 | + self::unsuppressUserName( $this->BlockAddress, $userId ); |
449 | 451 | } |
450 | 452 | } |
451 | 453 | } else { |
— | — | @@ -454,7 +456,7 @@ |
455 | 457 | |
456 | 458 | # Set *_deleted fields if requested |
457 | 459 | if( $this->BlockHideName ) { |
458 | | - $this->suppressUserName( $this->BlockAddress, $userId ); |
| 460 | + self::suppressUserName( $this->BlockAddress, $userId ); |
459 | 461 | } |
460 | 462 | |
461 | 463 | if ( $this->BlockWatchUser && |
— | — | @@ -485,36 +487,46 @@ |
486 | 488 | } |
487 | 489 | } |
488 | 490 | |
489 | | - private function suppressUserName( $name, $userId ) { |
| 491 | + public static function suppressUserName( $name, $userId ) { |
490 | 492 | $op = '|'; // bitwise OR |
491 | | - return $this->setUsernameBitfields( $name, $userId, $op ); |
| 493 | + return self::setUsernameBitfields( $name, $userId, $op ); |
492 | 494 | } |
493 | 495 | |
494 | | - private function unsuppressUserName( $name, $userId ) { |
| 496 | + public static function unsuppressUserName( $name, $userId ) { |
495 | 497 | $op = '&'; // bitwise AND |
496 | | - return $this->setUsernameBitfields( $name, $userId, $op ); |
| 498 | + return self::setUsernameBitfields( $name, $userId, $op ); |
497 | 499 | } |
498 | 500 | |
499 | | - private function setUsernameBitfields( $name, $userId, $op ) { |
| 501 | + private static function setUsernameBitfields( $name, $userId, $op ) { |
500 | 502 | if( $op !== '|' && $op !== '&' ) |
501 | 503 | return false; // sanity check |
502 | 504 | $dbw = wfGetDB( DB_MASTER ); |
503 | 505 | $delUser = Revision::DELETED_USER | Revision::DELETED_RESTRICTED; |
| 506 | + $delAction = LogPage::DELETED_ACTION | Revision::DELETED_RESTRICTED; |
| 507 | + # Normalize user name |
| 508 | + $userTitle = Title::makeTitleSafe( NS_USER, $name ); |
| 509 | + $userDbKey = $userTitle->getDBKey(); |
504 | 510 | # To suppress, we OR the current bitfields with Revision::DELETED_USER |
505 | 511 | # to put a 1 in the username *_deleted bit. To unsuppress we AND the |
506 | 512 | # current bitfields with the inverse of Revision::DELETED_USER. The |
507 | 513 | # username bit is made to 0 (x & 0 = 0), while others are unchanged (x & 1 = x). |
508 | 514 | # The same goes for the sysop-restricted *_deleted bit. |
509 | | - if( $op == '&' ) $delUser = "~{$delUser}"; |
| 515 | + if( $op == '&' ) { |
| 516 | + $delUser = "~{$delUser}"; |
| 517 | + $delAction = "~{$delAction}"; |
| 518 | + } |
510 | 519 | # Hide name from live edits |
511 | 520 | $dbw->update( 'revision', array("rev_deleted = rev_deleted $op $delUser"), |
512 | 521 | array('rev_user' => $userId), __METHOD__ ); |
513 | 522 | # Hide name from deleted edits |
514 | 523 | $dbw->update( 'archive', array("ar_deleted = ar_deleted $op $delUser"), |
515 | | - array('ar_user_text' => $userId), __METHOD__ ); |
| 524 | + array('ar_user_text' => $name), __METHOD__ ); |
516 | 525 | # Hide name from logs |
517 | 526 | $dbw->update( 'logging', array("log_deleted = log_deleted $op $delUser"), |
518 | | - array('log_user' => $userId), __METHOD__ ); |
| 527 | + array('log_user' => $userId, "log_type != 'suppress'"), __METHOD__ ); |
| 528 | + $dbw->update( 'logging', array("log_deleted = log_deleted $op $delAction"), |
| 529 | + array('log_namespace' => NS_USER, 'log_title' => $userDbKey, |
| 530 | + "log_type != 'suppress'"), __METHOD__ ); |
519 | 531 | # Hide name from RC |
520 | 532 | $dbw->update( 'recentchanges', array("rc_deleted = rc_deleted $op $delUser"), |
521 | 533 | array('rc_user_text' => $name), __METHOD__ ); |
Property changes on: branches/REL1_15/phase3/includes/specials |
___________________________________________________________________ |
Name: svn:mergeinfo |
522 | 534 | - /trunk/phase3/includes/specials:48836,48989,48992-48993,49051,49068,49086,49682,49775 |
/trunk/phase3/includes/specials/specials:48993 |
523 | 535 | + /trunk/phase3/includes/specials:48836,48886,48892,48989,48992-48993,49051,49068,49086,49191-49192,49682,49685,49730,49775,50070 |
/trunk/phase3/includes/specials/specials:48993 |
Property changes on: branches/REL1_15/phase3/includes |
___________________________________________________________________ |
Name: svn:mergeinfo |
524 | 536 | - /trunk/phase3/includes:48836,48989,48992,49051,49068,49086,49682,49775 |
/trunk/phase3/includes/specials:48993 |
525 | 537 | + /trunk/phase3/includes:48836,48886,48892,48989,48992,49051,49068,49086,49191-49192,49682,49685,49730,49775,50070 |
/trunk/phase3/includes/specials:48993 |
Property changes on: branches/REL1_15/phase3 |
___________________________________________________________________ |
Name: svn:mergeinfo |
526 | 538 | - /trunk/phase3:48814,48836,48909,48989,48992,49051,49068,49086,49682,49775 |
527 | 539 | + /trunk/phase3:48814,48836,48886,48892,48909,48989,48992,49051,49068,49086,49191-49192,49682,49685,49730,49775,50070 |