diff options
Diffstat (limited to 'includes/specials/SpecialWantedcategories.php')
-rw-r--r-- | includes/specials/SpecialWantedcategories.php | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/includes/specials/SpecialWantedcategories.php b/includes/specials/SpecialWantedcategories.php index b588dbf0..800e940a 100644 --- a/includes/specials/SpecialWantedcategories.php +++ b/includes/specials/SpecialWantedcategories.php @@ -30,28 +30,29 @@ */ class WantedCategoriesPage extends WantedQueryPage { - function getName() { - return 'Wantedcategories'; + function __construct( $name = 'Wantedcategories' ) { + parent::__construct( $name ); } - function getSQL() { - $dbr = wfGetDB( DB_SLAVE ); - list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' ); - $name = $dbr->addQuotes( $this->getName() ); - return - " - SELECT - $name as type, - " . NS_CATEGORY . " as namespace, - cl_to as title, - COUNT(*) as value - FROM $categorylinks - LEFT JOIN $page ON cl_to = page_title AND page_namespace = ". NS_CATEGORY ." - WHERE page_title IS NULL - GROUP BY cl_to - "; + function getQueryInfo() { + return array ( + 'tables' => array ( 'categorylinks', 'page' ), + 'fields' => array ( "'" . NS_CATEGORY . "' AS namespace", + 'cl_to AS title', + 'COUNT(*) AS value' ), + 'conds' => array ( 'page_title IS NULL' ), + 'options' => array ( 'GROUP BY' => 'cl_to' ), + 'join_conds' => array ( 'page' => array ( 'LEFT JOIN', + array ( 'page_title = cl_to', + 'page_namespace' => NS_CATEGORY ) ) ) + ); } + /** + * @param $skin Skin + * @param $result + * @return string + */ function formatResult( $skin, $result ) { global $wgLang, $wgContLang; @@ -73,14 +74,3 @@ class WantedCategoriesPage extends WantedQueryPage { return wfSpecialList($plink, $nlinks); } } - -/** - * constructor - */ -function wfSpecialWantedCategories() { - list( $limit, $offset ) = wfCheckLimits(); - - $wpp = new WantedCategoriesPage(); - - $wpp->doQuery( $offset, $limit ); -} |