r58385 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58384‎ | r58385 | r58386 >
Date:09:35, 31 October 2009
Author:raymond
Status:ok (Comments)
Tags:
Comment:
* (bug 20478) Add a note to Special:Block when the IP is already globally blocked
Works for blocks by TorBlock too
ToDo: bug 20188 for blocked usernames by CentralAuth
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/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
@@ -1967,6 +1967,7 @@
19681968 'ipb_hide_invalid',
19691969 'ipb_already_blocked',
19701970 'ipb-needreblock',
 1971+ 'ipb-otherblocks-header',
19711972 'ipb_cant_unblock',
19721973 'ipb_blocked_as_range',
19731974 'ip_range_invalid',
Index: trunk/phase3/includes/specials/SpecialBlockip.php
@@ -105,6 +105,9 @@
106106 $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
107107 $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $msg ) );
108108 } elseif( $this->BlockAddress ) {
 109+ # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
 110+ wfRunHooks( 'getOtherBlockLogLink', array( &$otherBlockedMsgs, $this->BlockAddress ) );
 111+
109112 $userId = is_object( $user ) ? $user->getId() : 0;
110113 $currentBlock = Block::newFromDB( $this->BlockAddress, $userId );
111114 if( !is_null( $currentBlock ) && !$currentBlock->mAuto && # The block exists and isn't an autoblock
@@ -112,7 +115,6 @@
113116 # or if it is, the range is what we're about to block
114117 ( $currentBlock->mAddress == $this->BlockAddress ) )
115118 ) {
116 - $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
117119 $alreadyBlocked = true;
118120 # Set the block form settings to the existing block
119121 if( !$this->wasPosted ) {
@@ -132,6 +134,23 @@
133135 }
134136 }
135137
 138+ # Show other blocks from extensions, i.e. GlockBlocking and TorBlock
 139+ if( count( $otherBlockedMsgs ) ) {
 140+ $wgOut->addHTML(
 141+ Html::rawElement( 'h2', array(), wfMsgExt( 'ipb-otherblocks-header', 'parseinline', count( $otherBlockedMsgs ) ) ) . "\n"
 142+ );
 143+ $list = '';
 144+ foreach( $otherBlockedMsgs as $link ) {
 145+ $list .= Html::rawElement( 'li', array(), $link ) . "\n";
 146+ }
 147+ $wgOut->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-blockip-alreadyblocked' ), $list ) . "\n" );
 148+ }
 149+
 150+ # Username/IP is blocked already locally
 151+ if( $alreadyBlocked ) {
 152+ $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
 153+ }
 154+
136155 $scBlockExpiryOptions = wfMsgForContent( 'ipboptions' );
137156
138157 $showblockoptions = $scBlockExpiryOptions != '-';
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2938,6 +2938,7 @@
29392939 'ipb-needreblock' => '== Already blocked ==
29402940 $1 is already blocked.
29412941 Do you want to change the settings?',
 2942+'ipb-otherblocks-header' => 'Other {{PLURAL:$1|block|blocks}}',
29422943 'ipb_cant_unblock' => 'Error: Block ID $1 not found.
29432944 It may have been unblocked already.',
29442945 'ipb_blocked_as_range' => 'Error: The IP $1 is not blocked directly and cannot be unblocked.
Index: trunk/phase3/RELEASE-NOTES
@@ -266,8 +266,8 @@
267267 contains the number of revisions in the history
268268 * $wgStylePath and $wgLogo are now set in the default LocalSettings.php file.
269269 * (bug 20186) Allow filtering history for revision deletion.
270 -* New hook getOtherBlockLogLink, called in Special:IPBlockList to show links
271 - to block logs of other blocking extensions, i.e. GlobalBlocking
 270+* New hook getOtherBlockLogLink, called in Special:IPBlockList and Special:Block
 271+ to show links to block logs of other blocking extensions, i.e. GlobalBlocking
272272 * Added search capabilities to SQLite backend
273273 * rebuildtextindex.php maintenance script now supports databases other than
274274 MySQL

Follow-up revisions

RevisionCommit summaryAuthorDate
r58938Follow-up r58385: Initialize variable to avoid a PHP notice.raymond07:53, 12 November 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r58261Refactor a bit. Function is needed to fix bug 20478 (Add a note to Special:Bl...raymond15:45, 28 October 2009

Comments

#Comment by Tim Starling (talk | contribs)   09:44, 30 December 2009

Same hook naming issue as r58192.

#Comment by Raymond (talk | contribs)   10:32, 30 December 2009

Done in r60494/r60497.

Status & tagging log