Replace some usages of Linker::link with LinkRenderer
authorVictor Barbu <victorbarbu08@gmail.com>
Thu, 1 Dec 2016 22:32:17 +0000 (00:32 +0200)
committerTTO <at.light@live.com.au>
Thu, 20 Apr 2017 02:13:30 +0000 (02:13 +0000)
Classes: PatrolLogFormatter and ProtectLogFormatter

Bug: T149346
Change-Id: If02094df5dd7acc6efd02e540515f8e472ec3d4d

includes/logging/PatrolLogFormatter.php
includes/logging/ProtectLogFormatter.php

index 5b933ce..bbd8bad 100644 (file)
@@ -22,6 +22,7 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
  * @since 1.22
  */
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
  * @since 1.22
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * This class formats patrol log entries.
 
 /**
  * This class formats patrol log entries.
@@ -54,7 +55,8 @@ class PatrolLogFormatter extends LogFormatter {
                                'oldid' => $oldid,
                                'diff' => 'prev'
                        ];
                                'oldid' => $oldid,
                                'diff' => 'prev'
                        ];
-                       $revlink = Linker::link( $target, htmlspecialchars( $revision ), [], $query );
+                       $revlink = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink(
+                               $target, $revision, [], $query );
                } else {
                        $revlink = htmlspecialchars( $revision );
                }
                } else {
                        $revlink = htmlspecialchars( $revision );
                }
index 0458297..9e5eea5 100644 (file)
@@ -21,6 +21,7 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
  * @since 1.26
  */
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
  * @since 1.26
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * This class formats protect log entries.
 
 /**
  * This class formats protect log entries.
@@ -77,6 +78,7 @@ class ProtectLogFormatter extends LogFormatter {
        }
 
        public function getActionLinks() {
        }
 
        public function getActionLinks() {
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
                $subtype = $this->entry->getSubtype();
                if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
                        || $subtype === 'move_prot' // the move log entry has the right action link
                $subtype = $this->entry->getSubtype();
                if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
                        || $subtype === 'move_prot' // the move log entry has the right action link
@@ -87,8 +89,8 @@ class ProtectLogFormatter extends LogFormatter {
                // Show history link for all changes after the protection
                $title = $this->entry->getTarget();
                $links = [
                // Show history link for all changes after the protection
                $title = $this->entry->getTarget();
                $links = [
-                       Linker::link( $title,
-                               $this->msg( 'hist' )->escaped(),
+                       $linkRenderer->makeLink( $title,
+                               $this->msg( 'hist' )->text(),
                                [],
                                [
                                        'action' => 'history',
                                [],
                                [
                                        'action' => 'history',
@@ -99,9 +101,9 @@ class ProtectLogFormatter extends LogFormatter {
 
                // Show change protection link
                if ( $this->context->getUser()->isAllowed( 'protect' ) ) {
 
                // Show change protection link
                if ( $this->context->getUser()->isAllowed( 'protect' ) ) {
-                       $links[] = Linker::linkKnown(
+                       $links[] = $linkRenderer->makeKnownLink(
                                $title,
                                $title,
-                               $this->msg( 'protect_change' )->escaped(),
+                               $this->msg( 'protect_change' )->text(),
                                [],
                                [ 'action' => 'protect' ]
                        );
                                [],
                                [ 'action' => 'protect' ]
                        );