4 * @subpackage 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
13 * @subpackage SpecialPage
15 class MostcategoriesPage
extends QueryPage
{
17 function getName() { return 'Mostcategories'; }
18 function isExpensive() { return true; }
19 function isSyndicated() { return false; }
22 $dbr =& wfGetDB( DB_SLAVE
);
23 extract( $dbr->tableNames( 'categorylinks', 'page' ) );
27 'Mostcategories' as type,
28 page_namespace as namespace,
32 LEFT JOIN $page ON cl_from = page_id
33 WHERE page_namespace = " . NS_MAIN
. "
39 function formatResult( $skin, $result ) {
40 global $wgContLang, $wgLang;
42 $nt = Title
::makeTitle( $result->namespace, $result->title
);
43 $text = $wgContLang->convert( $nt->getPrefixedText() );
45 $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
47 $nl = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ),
48 $wgLang->formatNum( $result->value
) );
50 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Categories' ),
51 $nl, 'article=' . $nt->getPrefixedURL() );
53 return wfSpecialList($plink, $nlink);
60 function wfSpecialMostcategories() {
61 list( $limit, $offset ) = wfCheckLimits();
63 $wpp = new MostcategoriesPage();
65 $wpp->doQuery( $offset, $limit );