r113792 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113791‎ | r113792 | r113793 >
Date:01:42, 14 March 2012
Author:aaron
Status:reverted
Tags:1.19, gerritmigration 
Comment:
(bug 32827) "[Regression] Block log for IP ranges not shown on Special:Block"
Modified paths:
  • /trunk/phase3/includes/specials/SpecialBlock.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialBlock.php
@@ -381,19 +381,19 @@
382382 $this->getLanguage()->pipeList( $links )
383383 );
384384
385 - if( $this->target instanceof User ){
 385+ $userTitle = self::getTargetUserTitle( $this->target );
 386+ if( $userTitle ){
386387 # Get relevant extracts from the block and suppression logs, if possible
387 - $userpage = $this->target->getUserPage();
388388 $out = '';
389389
390390 LogEventsList::showLogExtract(
391391 $out,
392392 'block',
393 - $userpage,
 393+ $userTitle,
394394 '',
395395 array(
396396 'lim' => 10,
397 - 'msgKey' => array( 'blocklog-showlog', $userpage->getText() ),
 397+ 'msgKey' => array( 'blocklog-showlog', $userTitle->getText() ),
398398 'showIfEmpty' => false
399399 )
400400 );
@@ -404,12 +404,12 @@
405405 LogEventsList::showLogExtract(
406406 $out,
407407 'suppress',
408 - $userpage,
 408+ $userTitle,
409409 '',
410410 array(
411411 'lim' => 10,
412412 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
413 - 'msgKey' => array( 'blocklog-showsuppresslog', $userpage->getText() ),
 413+ 'msgKey' => array( 'blocklog-showsuppresslog', $userTitle->getText() ),
414414 'showIfEmpty' => false
415415 )
416416 );
@@ -422,6 +422,21 @@
423423 }
424424
425425 /**
 426+ * Get a user page target for things like logs.
 427+ * This handles account and IP range targets.
 428+ * @param $target User|string
 429+ * @return Title|null
 430+ */
 431+ protected static function getTargetUserTitle( $target ) {
 432+ if( $target instanceof User ) {
 433+ return $target->getUserPage();
 434+ } elseif ( IP::isIPAddress( $target ) ) {
 435+ return Title::makeTitleSafe( NS_USER, $target );
 436+ }
 437+ return null;
 438+ }
 439+
 440+ /**
426441 * Determine the target of the block, and the type of target
427442 * TODO: should be in Block.php?
428443 * @param $par String subpage parameter passed to setup, or data value from

Follow-up revisions

RevisionCommit summaryAuthorDate
r114335Revert r107309, r113601, r113704, r113742, r113792, r113838, r113859, r113893......catrope00:16, 21 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83786Divert a river through the Augean Stables that is SpecialBlockip.php....happy-melon21:54, 12 March 2011

Status & tagging log