X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMostlinkedcategories.php;h=41678cb34d60fa92ad201d29481ec78ea52be31a;hb=8b220cb5b6c5d3779b20a1d59de97291ece80282;hp=b8316f3eb0c048cefd4996fb4c872b0844faa889;hpb=734ca2b4d2a1246fb0ea1e54b861ab423ab5e257;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialMostlinkedcategories.php b/includes/specials/SpecialMostlinkedcategories.php index b8316f3eb0..56a701a304 100644 --- a/includes/specials/SpecialMostlinkedcategories.php +++ b/includes/specials/SpecialMostlinkedcategories.php @@ -24,6 +24,10 @@ * @author Ævar Arnfjörð Bjarmason */ +use MediaWiki\MediaWikiServices; +use Wikimedia\Rdbms\IResultWrapper; +use Wikimedia\Rdbms\IDatabase; + /** * A querypage to show categories ordered in descending order by the pages in them * @@ -56,21 +60,10 @@ class MostlinkedCategoriesPage extends QueryPage { * Fetch user page links and cache their existence * * @param IDatabase $db - * @param ResultWrapper $res + * @param IResultWrapper $res */ function preprocessResults( $db, $res ) { - if ( !$res->numRows() ) { - return; - } - - $batch = new LinkBatch; - foreach ( $res as $row ) { - $batch->add( NS_CATEGORY, $row->title ); - } - $batch->execute(); - - // Back to start for display - $res->seek( 0 ); + $this->executeLBFromResultWrapper( $res ); } /** @@ -79,8 +72,6 @@ class MostlinkedCategoriesPage extends QueryPage { * @return string */ function formatResult( $skin, $result ) { - global $wgContLang; - $nt = Title::makeTitleSafe( NS_CATEGORY, $result->title ); if ( !$nt ) { return Html::element( @@ -93,8 +84,9 @@ class MostlinkedCategoriesPage extends QueryPage { ); } - $text = $wgContLang->convert( $nt->getText() ); - $plink = Linker::link( $nt, htmlspecialchars( $text ) ); + $text = MediaWikiServices::getInstance()->getContentLanguage() + ->convert( htmlspecialchars( $nt->getText() ) ); + $plink = $this->getLinkRenderer()->makeLink( $nt, new HtmlArmor( $text ) ); $nlinks = $this->msg( 'nmembers' )->numParams( $result->value )->escaped(); return $this->getLanguage()->specialList( $plink, $nlinks );