X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMostlinkedtemplates.php;h=22932e5cc9c53e61287843a1788dc3532c9823b4;hb=fcdf2518605954fe1bcf88598fc14bd95d525882;hp=ab9e1527397e9ad5076b158a35c34f6b84a7623b;hpb=4148b2512b02eb8d4dd8f5427ce082fb4b0194d2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialMostlinkedtemplates.php b/includes/specials/SpecialMostlinkedtemplates.php index ab9e152739..22932e5cc9 100644 --- a/includes/specials/SpecialMostlinkedtemplates.php +++ b/includes/specials/SpecialMostlinkedtemplates.php @@ -64,28 +64,32 @@ class MostlinkedTemplatesPage extends QueryPage { public function getQueryInfo() { return array ( 'tables' => array ( 'templatelinks' ), - 'fields' => array ( 'tl_namespace AS namespace', - 'tl_title AS title', - 'COUNT(*) AS value' ), + 'fields' => array ( 'namespace' => 'tl_namespace', + 'title' => 'tl_title', + 'value' => 'COUNT(*)' ), 'conds' => array ( 'tl_namespace' => NS_TEMPLATE ), - 'options' => array( 'GROUP BY' => 'namespace, title' ) + 'options' => array( 'GROUP BY' => array( 'tl_namespace', 'tl_title' ) ) ); } /** * Pre-cache page existence to speed up link generation * - * @param $db Database connection + * @param $db DatabaseBase connection * @param $res ResultWrapper */ public function preprocessResults( $db, $res ) { + if ( !$res->numRows() ) { + return; + } + $batch = new LinkBatch(); foreach ( $res as $row ) { $batch->add( $row->namespace, $row->title ); } $batch->execute(); - if( $db->numRows( $res ) > 0 ) - $db->dataSeek( $res, 0 ); + + $res->seek( 0 ); } /** @@ -96,9 +100,13 @@ class MostlinkedTemplatesPage extends QueryPage { * @return String */ public function formatResult( $skin, $result ) { - $title = Title::makeTitle( $result->namespace, $result->title ); + $title = Title::makeTitleSafe( $result->namespace, $result->title ); + if ( !$title ) { + return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), + Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) ); + } - return $this->getLang()->specialList( + return $this->getLanguage()->specialList( Linker::link( $title ), $this->makeWlhLink( $title, $result ) );