From: Alexandre Emsenhuber Date: Thu, 2 Aug 2012 20:36:45 +0000 (+0200) Subject: Fixes to Special:Mostlinkedtemplates. X-Git-Tag: 1.31.0-rc.0~22857^2 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=4d386c68a1f5ed67261c0a17feca27a8e17c0211;p=lhc%2Fweb%2Fwiklou.git Fixes to Special:Mostlinkedtemplates. - Don't execute the LinkBatch if there are no rows. - Checks for invalid titles and output a message if this is the case. Change-Id: Ibd3794fbe165b13f3b386a9dabe4b6fabb7ba1d8 --- diff --git a/includes/specials/SpecialMostlinkedtemplates.php b/includes/specials/SpecialMostlinkedtemplates.php index 370ba68b88..0b587dcf9f 100644 --- a/includes/specials/SpecialMostlinkedtemplates.php +++ b/includes/specials/SpecialMostlinkedtemplates.php @@ -79,13 +79,17 @@ class MostlinkedTemplatesPage extends QueryPage { * @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,7 +100,11 @@ 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->getLanguage()->specialList( Linker::link( $title ),