X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMostlinked.php;h=01eb39e3f6205565d9023b5540cb00d20570fa28;hb=4774d1e0ac2dedda44de7b16f9ec16f0c36ebdc2;hp=019df4937af49cbece50dd61db4baabd51879456;hpb=ea9fcc1e4d3b572199d82c426024e3e5efe23879;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialMostlinked.php b/includes/specials/SpecialMostlinked.php index 019df4937a..01eb39e3f6 100644 --- a/includes/specials/SpecialMostlinked.php +++ b/includes/specials/SpecialMostlinked.php @@ -44,31 +44,31 @@ class MostlinkedPage extends QueryPage { } public function getQueryInfo() { - return array( - 'tables' => array( 'pagelinks', 'page' ), - 'fields' => array( + return [ + 'tables' => [ 'pagelinks', 'page' ], + 'fields' => [ 'namespace' => 'pl_namespace', 'title' => 'pl_title', 'value' => 'COUNT(*)', 'page_namespace' - ), - 'options' => array( + ], + 'options' => [ 'HAVING' => 'COUNT(*) > 1', - 'GROUP BY' => array( + 'GROUP BY' => [ 'pl_namespace', 'pl_title', 'page_namespace' - ) - ), - 'join_conds' => array( - 'page' => array( + ] + ], + 'join_conds' => [ + 'page' => [ 'LEFT JOIN', - array( + [ 'page_namespace = pl_namespace', 'page_title = pl_title' - ) - ) - ) - ); + ] + ] + ] + ]; } /** @@ -78,16 +78,7 @@ class MostlinkedPage extends QueryPage { * @param ResultWrapper $res */ function preprocessResults( $db, $res ) { - if ( $res->numRows() > 0 ) { - $linkBatch = new LinkBatch(); - - foreach ( $res as $row ) { - $linkBatch->add( $row->namespace, $row->title ); - } - - $res->seek( 0 ); - $linkBatch->execute(); - } + $this->executeLBFromResultWrapper( $res ); } /** @@ -116,7 +107,7 @@ class MostlinkedPage extends QueryPage { if ( !$title ) { return Html::element( 'span', - array( 'class' => 'mw-invalidtitle' ), + [ 'class' => 'mw-invalidtitle' ], Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace,