Matěj Suchánek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/364111 )
Change subject: Use LogFormatter::getLinkRenderer in LogFormatter extensions ...................................................................... Use LogFormatter::getLinkRenderer in LogFormatter extensions And additionally, migrate another two usages of deprecated Linker methods. Bug: T149346 Change-Id: I222da144a37f7d77eaf4bdde901b58c992f1af85 --- M includes/logging/BlockLogFormatter.php M includes/logging/ContentModelLogFormatter.php M includes/logging/DeleteLogFormatter.php M includes/logging/LogFormatter.php M includes/logging/MergeLogFormatter.php M includes/logging/MoveLogFormatter.php M includes/logging/PatrolLogFormatter.php M includes/logging/ProtectLogFormatter.php 8 files changed, 11 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/11/364111/1 diff --git a/includes/logging/BlockLogFormatter.php b/includes/logging/BlockLogFormatter.php index a0bfb59..25589de 100644 --- a/includes/logging/BlockLogFormatter.php +++ b/includes/logging/BlockLogFormatter.php @@ -22,8 +22,6 @@ * @since 1.25 */ -use MediaWiki\MediaWikiServices; - /** * This class formats block log entries. * @@ -99,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' ) diff --git a/includes/logging/ContentModelLogFormatter.php b/includes/logging/ContentModelLogFormatter.php index 861ea30..e05357c 100644 --- a/includes/logging/ContentModelLogFormatter.php +++ b/includes/logging/ContentModelLogFormatter.php @@ -1,7 +1,5 @@ <?php -use MediaWiki\MediaWikiServices; - class ContentModelLogFormatter extends LogFormatter { protected function getMessageParameters() { $lang = $this->context->getLanguage(); @@ -20,7 +18,7 @@ } $params = $this->extractParameters(); - $revert = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink( + $revert = $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'ChangeContentModel' ), $this->msg( 'logentry-contentmodel-change-revertlink' )->text(), [], diff --git a/includes/logging/DeleteLogFormatter.php b/includes/logging/DeleteLogFormatter.php index ceb0052..ef00634 100644 --- a/includes/logging/DeleteLogFormatter.php +++ b/includes/logging/DeleteLogFormatter.php @@ -23,8 +23,6 @@ * @since 1.22 */ -use MediaWiki\MediaWikiServices; - /** * This class formats delete log entries. * @@ -135,7 +133,7 @@ public function getActionLinks() { $user = $this->context->getUser(); - $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); + $linkRenderer = $this->getLinkRenderer(); if ( !$user->isAllowed( 'deletedhistory' ) || $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) { diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index 2a47943..b58cc34 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -645,7 +645,8 @@ */ protected function makePageLink( Title $title = null, $parameters = [], $html = 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" ); diff --git a/includes/logging/MergeLogFormatter.php b/includes/logging/MergeLogFormatter.php index b0edd4c..8775097 100644 --- a/includes/logging/MergeLogFormatter.php +++ b/includes/logging/MergeLogFormatter.php @@ -54,9 +54,9 @@ // Show unmerge link $params = $this->extractParameters(); - $revert = Linker::linkKnown( + $revert = $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'MergeHistory' ), - $this->msg( 'revertmerge' )->escaped(), + $this->msg( 'revertmerge' )->text(), [], [ 'target' => $params[3], diff --git a/includes/logging/MoveLogFormatter.php b/includes/logging/MoveLogFormatter.php index afbf8e9..43ca0ea 100644 --- a/includes/logging/MoveLogFormatter.php +++ b/includes/logging/MoveLogFormatter.php @@ -71,9 +71,9 @@ return ''; } - $revert = Linker::linkKnown( + $revert = $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'Movepage' ), - $this->msg( 'revertmove' )->escaped(), + $this->msg( 'revertmove' )->text(), [], [ 'wpOldTitle' => $destTitle->getPrefixedDBkey(), diff --git a/includes/logging/PatrolLogFormatter.php b/includes/logging/PatrolLogFormatter.php index bbd8bad..894f59b 100644 --- a/includes/logging/PatrolLogFormatter.php +++ b/includes/logging/PatrolLogFormatter.php @@ -22,7 +22,6 @@ * @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. @@ -55,8 +54,7 @@ 'oldid' => $oldid, 'diff' => 'prev' ]; - $revlink = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink( - $target, $revision, [], $query ); + $revlink = $this->getLinkRenderer()->makeLink( $target, $revision, [], $query ); } else { $revlink = htmlspecialchars( $revision ); } diff --git a/includes/logging/ProtectLogFormatter.php b/includes/logging/ProtectLogFormatter.php index 9e5eea5..64ec626 100644 --- a/includes/logging/ProtectLogFormatter.php +++ b/includes/logging/ProtectLogFormatter.php @@ -21,7 +21,6 @@ * @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. @@ -78,7 +77,7 @@ } public function getActionLinks() { - $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); + $linkRenderer = $this->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 -- To view, visit https://gerrit.wikimedia.org/r/364111 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I222da144a37f7d77eaf4bdde901b58c992f1af85 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Matěj Suchánek <matejsuchane...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits