summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialMostcategories.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialMostcategories.php')
-rw-r--r--includes/specials/SpecialMostcategories.php49
1 files changed, 21 insertions, 28 deletions
diff --git a/includes/specials/SpecialMostcategories.php b/includes/specials/SpecialMostcategories.php
index 124f0bd5..2e437196 100644
--- a/includes/specials/SpecialMostcategories.php
+++ b/includes/specials/SpecialMostcategories.php
@@ -31,28 +31,32 @@
*/
class MostcategoriesPage extends QueryPage {
- function getName() { return 'Mostcategories'; }
+ function __construct( $name = 'Mostcategories' ) {
+ parent::__construct( $name );
+ }
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
- function getSQL() {
- $dbr = wfGetDB( DB_SLAVE );
- list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' );
- return
- "
- SELECT
- 'Mostcategories' as type,
- page_namespace as namespace,
- page_title as title,
- COUNT(*) as value
- FROM $categorylinks
- LEFT JOIN $page ON cl_from = page_id
- WHERE page_namespace = " . NS_MAIN . "
- GROUP BY page_namespace, page_title
- HAVING COUNT(*) > 1
- ";
+ function getQueryInfo() {
+ return array (
+ 'tables' => array ( 'categorylinks', 'page' ),
+ 'fields' => array ( 'page_namespace AS namespace',
+ 'page_title AS title',
+ 'COUNT(*) AS value' ),
+ 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces() ),
+ 'options' => array ( 'HAVING' => 'COUNT(*) > 1',
+ 'GROUP BY' => 'page_namespace, page_title' ),
+ 'join_conds' => array ( 'page' => array ( 'LEFT JOIN',
+ 'page_id = cl_from' ) )
+ );
}
+ /**
+ * @param $skin Skin
+ * @param $result
+ * @return string
+ */
function formatResult( $skin, $result ) {
global $wgLang;
$title = Title::makeTitleSafe( $result->namespace, $result->title );
@@ -62,14 +66,3 @@ class MostcategoriesPage extends QueryPage {
return wfSpecialList( $link, $count );
}
}
-
-/**
- * constructor
- */
-function wfSpecialMostcategories() {
- list( $limit, $offset ) = wfCheckLimits();
-
- $wpp = new MostcategoriesPage();
-
- $wpp->doQuery( $offset, $limit );
-}