Merge "Use LogFormatter::getLinkRenderer in LogFormatter extensions"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 21 Oct 2017 17:13:44 +0000 (17:13 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 21 Oct 2017 17:13:44 +0000 (17:13 +0000)
1  2 
includes/logging/BlockLogFormatter.php
includes/logging/LogFormatter.php

@@@ -22,8 -22,6 +22,6 @@@
   * @since 1.25
   */
  
- use MediaWiki\MediaWikiServices;
  /**
   * This class formats block log entries.
   *
@@@ -60,7 -58,7 +58,7 @@@ class BlockLogFormatter extends LogForm
                        // is shown on the correct side of the tooltip text.
                        $durationTooltip = '&lrm;' . htmlspecialchars( $params[4] );
                        $params[4] = Message::rawParam(
 -                              "<span class='blockExpiry' title='$durationTooltip'>" .
 +                              "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
                                $this->context->getLanguage()->translateBlockExpiry(
                                        $params[4],
                                        $this->context->getUser(),
@@@ -99,7 -97,7 +97,7 @@@
  
        public function getActionLinks() {
                $subtype = $this->entry->getSubtype();
-               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+               $linkRenderer = $this->getLinkRenderer();
                if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
                        || !( $subtype === 'block' || $subtype === 'reblock' )
                        || !$this->context->getUser()->isAllowed( 'block' )
@@@ -644,12 -644,13 +644,13 @@@ class LogFormatter 
         * @return string
         */
        protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
+               if ( !$title instanceof Title ) {
+                       throw new MWException( 'Expected title, got null' );
+               }
                if ( !$this->plaintext ) {
-                       $link = Linker::link( $title, $html, [], $parameters );
+                       $html = $html !== null ? new HtmlArmor( $html ) : $html;
+                       $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
                } else {
-                       if ( !$title instanceof Title ) {
-                               throw new MWException( "Expected title, got null" );
-                       }
                        $link = '[[' . $title->getPrefixedText() . ']]';
                }
  
                        case 'title':
                        case 'title-link':
                                $title = Title::newFromText( $value );
 -                              if ( $title ) {
 -                                      $value = [];
 -                                      ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
 +                              if ( !$title ) {
 +                                      // Huh? Do something halfway sane.
 +                                      $title = SpecialPage::getTitleFor( 'Badtitle', $value );
                                }
 +                              $value = [];
 +                              ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
                                return $value;
  
                        case 'user':