r58192 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58191‎ | r58192 | r58193 >
Date:14:08, 27 October 2009
Author:raymond
Status:resolved (Comments)
Tags:
Comment:
New hook getOtherBlockLogLink, called in Special:IPBlockList to show links to block logs of other blocking extensions, i.e. GlobalBlocking
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/specials/SpecialIpblocklist.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
@@ -1988,6 +1988,7 @@
19891989 'ipblocklist-sh-addressblocks',
19901990 'ipblocklist-summary',
19911991 'ipblocklist-submit',
 1992+ 'ipblocklist-otherblocks',
19921993 'blocklistline',
19931994 'infiniteblock',
19941995 'expiringblock',
Index: trunk/phase3/docs/hooks.txt
@@ -782,6 +782,11 @@
783783 $url: string value as output (out parameter, can modify)
784784 $query: query options passed to Title::getLocalURL()
785785
 786+'getOtherBlockLogLink': Get links to the block log from extensions which blocks
 787+ users and/or IP addresses too
 788+$otherBlockLink: An array with links to other block logs
 789+$$this->ip: The requested IP address or username
 790+
786791 'GetPreferences': modify user preferences
787792 $user: User whose preferences are being modified.
788793 &$preferences: Preferences description array, to be fed to an HTMLForm object
Index: trunk/phase3/includes/specials/SpecialIpblocklist.php
@@ -311,6 +311,20 @@
312312 $wgOut->addHTML( $this->searchForm() );
313313 $wgOut->addWikiMsg( 'ipblocklist-empty' );
314314 }
 315+
 316+ $otherBlockLink = array();
 317+ wfRunHooks( 'getOtherBlockLogLink', array( &$otherBlockLink, $this->ip ) );
 318+ if( count( $otherBlockLink ) ) {
 319+ $wgOut->addHTML(
 320+ Html::rawElement( 'h2', array(), wfMsg( 'ipblocklist-otherblocks' ) ) . "\n"
 321+ );
 322+ $list = '';
 323+ foreach( $otherBlockLink as $link ) {
 324+ $list .= Html::rawElement( 'li', array(), $link ) . "\n";
 325+ }
 326+ $wgOut->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" );
 327+ }
 328+
315329 }
316330
317331 function searchForm() {
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2953,6 +2953,7 @@
29542954 'ipblocklist-sh-addressblocks' => '$1 single IP blocks',
29552955 'ipblocklist-summary' => '', # do not translate or duplicate this message to other languages
29562956 'ipblocklist-submit' => 'Search',
 2957+'ipblocklist-otherblocks' => 'Other blocks',
29572958 'blocklistline' => '$1, $2 blocked $3 ($4)',
29582959 'infiniteblock' => 'infinite',
29592960 'expiringblock' => 'expires on $1 at $2',
Index: trunk/phase3/RELEASE-NOTES
@@ -263,6 +263,8 @@
264264 contains the number of revisions in the history
265265 * $wgStylePath and $wgLogo are now set in the default LocalSettings.php file.
266266 * (bug 20186) Allow filtering history for revision deletion.
 267+* New hook getOtherBlockLogLink, called in Special:IPBlockList to show links
 268+ to block logs of other blocking extensions, i.e. GlobalBlocking
267269
268270 === Bug fixes in 1.16 ===
269271

Follow-up revisions

RevisionCommit summaryAuthorDate
r58193Use the new hook from r58192: Create a link to the GlobalBlockLograymond14:10, 27 October 2009
r58199Use the new hook from r58192: Creates a "is blocked as a Tor exit node" messa...raymond16:28, 27 October 2009
r58323Follow-up r58192: Improved version. Split info for local and other blocks. Se...raymond16:37, 29 October 2009
r60494Rename hook per Tim's CR on r58192raymond08:51, 30 December 2009

Comments

#Comment by Tim Starling (talk | contribs)   07:01, 30 December 2009

Hook names conventionally start with a capital letter, and omit the verb, because there is a little-known feature in Hooks.php which adds "on" to the start of the hook name to make a method name. This hook should be called "OtherBlockLogLink". Also in the documentation, the parameter should be given a more sensible name, like $ip, rather than $this->ip.

The screenshot on r58323 looks nice.

#Comment by Raymond (talk | contribs)   08:53, 30 December 2009

Thanks for CR.

  • Hook renamed in r60494
  • Hook doc already changed by Ialex in r59182

Status & tagging log