X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=blobdiff_plain;f=includes%2FTemplatesOnThisPageFormatter.php;h=215e4ec8136bc53c92effaf963148779318f7dc4;hb=4bd69c7536aa8b8aa7850748435761d5572b368c;hp=c0ae374a05fbcdc1d771f501d3d82dc5045ad621;hpb=ffa16cf8ae23d1007f99e322b7d5ab93eb5624ac;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/TemplatesOnThisPageFormatter.php b/includes/TemplatesOnThisPageFormatter.php index c0ae374a05..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 = '
'; @@ -93,11 +90,11 @@ class TemplatesOnThisPageFormatter { } if ( $more instanceof LinkTarget ) { - $outText .= Html::rawElement( 'li', $this->linkRenderer->makeLink( + $outText .= Html::rawElement( 'li', [], $this->linkRenderer->makeLink( $more, $this->context->msg( 'moredotdotdot' )->text() ) ); } elseif ( $more ) { // Documented as should already be escaped - $outText .= Html::rawElement( 'li', $more ); + $outText .= Html::rawElement( 'li', [], $more ); } $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';