X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTemplatesOnThisPageFormatter.php;h=215e4ec8136bc53c92effaf963148779318f7dc4;hb=e390198c4e4be7632b01173e42050061f1cc346a;hp=494c7bfc86cbdedeeaac809e2fa5a758b4c8ad19;hpb=84ca06799fe71d6b60d319fde335adfe637963e7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/TemplatesOnThisPageFormatter.php b/includes/TemplatesOnThisPageFormatter.php index 494c7bfc86..215e4ec813 100644 --- a/includes/TemplatesOnThisPageFormatter.php +++ b/includes/TemplatesOnThisPageFormatter.php @@ -20,6 +20,7 @@ use MediaWiki\Linker\LinkRenderer; use MediaWiki\Linker\LinkTarget; +use MediaWiki\MediaWikiServices; /** * Handles formatting for the "templates used on this page" @@ -66,11 +67,7 @@ class TemplatesOnThisPageFormatter { } # Do a batch existence check - $batch = new LinkBatch; - foreach ( $templates as $title ) { - $batch->addObj( $title ); - } - $batch->execute(); + ( new LinkBatch( $templates ) )->execute(); # Construct the HTML $outText = '
'; @@ -162,11 +159,13 @@ class TemplatesOnThisPageFormatter { * Return a link to the edit page, with the text * saying "view source" if the user can't edit the page * - * @param Title $titleObj + * @param LinkTarget $titleObj * @return string */ - private function buildEditLink( Title $titleObj ) { - if ( $titleObj->quickUserCan( 'edit', $this->context->getUser() ) ) { + private function buildEditLink( LinkTarget $titleObj ) { + if ( MediaWikiServices::getInstance()->getPermissionManager() + ->quickUserCan( 'edit', $this->context->getUser(), $titleObj ) + ) { $linkMsg = 'editlink'; } else { $linkMsg = 'viewsourcelink';