more specific error message, using WikiError, if user trys to create account with...
[mediawiki.git] / includes / specials / SpecialMostcategories.php
blob1ba05626901e7fbf83ded97e95e7f295f9be2d89
1 <?php
2 /**
3 * @file
4 * @ingroup SpecialPage
6 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
7 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
8 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
9 */
11 /**
12 * implements Special:Mostcategories
13 * @ingroup SpecialPage
15 class MostcategoriesPage extends QueryPage {
17 function getName() { return 'Mostcategories'; }
18 function isExpensive() { return true; }
19 function isSyndicated() { return false; }
21 function getSQL() {
22 $dbr = wfGetDB( DB_SLAVE );
23 list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' );
24 return
26 SELECT
27 'Mostcategories' as type,
28 page_namespace as namespace,
29 page_title as title,
30 COUNT(*) as value
31 FROM $categorylinks
32 LEFT JOIN $page ON cl_from = page_id
33 WHERE page_namespace = " . NS_MAIN . "
34 GROUP BY page_namespace, page_title
35 HAVING COUNT(*) > 1
39 function formatResult( $skin, $result ) {
40 global $wgLang;
41 $title = Title::makeTitleSafe( $result->namespace, $result->title );
43 $count = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value ) );
44 $link = $skin->link( $title );
45 return wfSpecialList( $link, $count );
49 /**
50 * constructor
52 function wfSpecialMostcategories() {
53 list( $limit, $offset ) = wfCheckLimits();
55 $wpp = new MostcategoriesPage();
57 $wpp->doQuery( $offset, $limit );