r36113 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36112‎ | r36113 | r36114 >
Date:23:16, 9 June 2008
Author:brion
Status:old
Tags:
Comment:
Revert r36076, r36109, r36110 -- just doesn't work right. Sometimes removes blocks, sometimes fails to remove blocks, sometimes fails to modify blocks.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1618,6 +1618,7 @@
16191619 'ipb_expiry_invalid',
16201620 'ipb_expiry_temp',
16211621 'ipb_already_blocked',
 1622+ 'ipb_tweak_block',
16221623 'ipb_modifying_block',
16231624 'ipb_tweak_block',
16241625 'ipb_cant_unblock',
Index: trunk/phase3/includes/SpecialBlockip.php
@@ -32,10 +32,8 @@
3333 } else if ( $wgRequest->wasPosted() && 'submit' == $action &&
3434 $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
3535 $ipb->doSubmit();
36 - } else if ( $ipb->AlreadyBlocked ) {
37 - $ipb->showForm( wfMsg('ipb_tweak_block', $ipb->BlockAddress ) );
3836 } else {
39 - $ipb->showForm('');
 37+ $ipb->showForm( '' );
4038 }
4139 }
4240
@@ -49,32 +47,10 @@
5048 # var $BlockEmail;
5149
5250 function IPBlockForm( $par ) {
53 - global $wgRequest, $wgUser, $wgLang;
 51+ global $wgRequest, $wgUser;
5452
5553 $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) );
5654 $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' );
57 - $this->AlreadyBlocked = false;
58 -
59 - if( $this->BlockAddress && !$wgRequest->wasPosted() ){
60 - $this->mBlock = new Block();
61 - if( $this->mBlock->load($this->BlockAddress) && $this->BlockAddress == $this->mBlock->mAddress ) {
62 - $this->AlreadyBlocked = true;
63 - $this->BlockReason = wfMsgForContent( 'ipb_modifying_block' );
64 - $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' );
65 - $this->BlockExpiry = wfMsg('ipbotheroption');
66 - $this->BlockOther = $wgLang->timeanddate( $this->mBlock->mExpiry );
67 - $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', true );
68 - $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', true );
69 - $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', true );
70 - $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false );
71 - $this->BlockEmail = $this->mBlock->mBlockEmail;
72 - $this->BlockWatchUser = $wgRequest->getBool( 'wpWatchUser', false );
73 - # Re-check user's rights to hide names, very serious, defaults to 0
74 - $this->BlockHideName = ( $this->mBlock->mHideName && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0;
75 - return true;
76 - }
77 - }
78 -
7955 $this->BlockReason = $wgRequest->getText( 'wpBlockReason' );
8056 $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' );
8157 $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') );
@@ -93,7 +69,7 @@
9470 }
9571
9672 function showForm( $err ) {
97 - global $wgOut, $wgUser, $wgSysopUserBans, $wgRequest;
 73+ global $wgOut, $wgUser, $wgSysopUserBans;
9874
9975 $wgOut->setPagetitle( wfMsg( 'blockip' ) );
10076 $wgOut->addWikiMsg( 'blockiptext' );
@@ -110,10 +86,8 @@
11187
11288 $titleObj = SpecialPage::getTitleFor( 'Blockip' );
11389
114 - if ( $wgRequest->wasPosted() ) {
115 - $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
116 - }
11790 if ( "" != $err ) {
 91+ $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
11892 $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $err ) );
11993 }
12094
@@ -388,12 +362,10 @@
389363
390364 if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
391365
392 - if ( $oldblock = Block::newFromDB( $this->BlockAddress ) && $oldblock->mAddress == $this->BlockAddress ) {
393 - $oldblock->delete(); // Block already exists. Silently delete it
 366+ if ( !$block->insert() ) {
 367+ return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress));
394368 }
395 - $block->insert();
396369
397 -
398370 wfRunHooks('BlockIpComplete', array($block, $wgUser));
399371
400372 if ( $this->BlockWatchUser ) {
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2363,9 +2363,6 @@
23642364 'ipb_expiry_invalid' => 'Expiry time invalid.',
23652365 'ipb_expiry_temp' => 'Hidden username blocks should be permanent.',
23662366 'ipb_already_blocked' => '"$1" is already blocked',
2367 -'ipb_modifying_block' => 'Modifying existing block:',
2368 -'ipb_tweak_block' => 'Caution: This user ($1) is already blocked.
2369 -You can use this form to change the block settings.',
23702367 'ipb_cant_unblock' => 'Error: Block ID $1 not found. It may have been unblocked already.',
23712368 'ipb_blocked_as_range' => 'Error: The IP $1 is not blocked directly and cannot be unblocked.
23722369 It is, however, blocked as part of the range $2, which can be unblocked.',
Index: trunk/phase3/RELEASE-NOTES
@@ -342,7 +342,6 @@
343343 * (bug 14385) "Move subpages" option no longer tries to move to invalid titles
344344 * (bug 14386) Fix subpage namespace oddity when moving a talk page
345345 * (bug 11771) Signup form now not shown if in read-only mode.
346 -* (bug 10080) Users can now modify an existing block without unblocking first.
347346 * (bug 12859) $wgRateLimitsExcludedGroups has been deprecated in favor of
348347 $wgGroupPermissions[]['noratelimit'].
349348 * (Bug 13828) Split parameter $1 of MediaWiki:Missingarticle into $1 (=title)

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r36076Bug 10080 - Finally fixed. No longer mis-detects an individual IP as blocked ...demon13:03, 9 June 2008
r36109Alrighty, now we properly remove old blocks before inserting the new one. (Bu...demon22:03, 9 June 2008
r36110Minor logic error on removing blocks on range when tweaking an IP.demon22:35, 9 June 2008

Status & tagging log