4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 * http://www.gnu.org/copyleft/gpl.html
22 * @ingroup SpecialPage
24 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
25 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
26 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
30 * implements Special:Mostcategories
31 * @ingroup SpecialPage
33 class MostcategoriesPage
extends QueryPage
{
35 function getName() { return 'Mostcategories'; }
36 function isExpensive() { return true; }
37 function isSyndicated() { return false; }
40 $dbr = wfGetDB( DB_SLAVE
);
41 list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' );
45 'Mostcategories' as type,
46 page_namespace as namespace,
50 LEFT JOIN $page ON cl_from = page_id
51 WHERE page_namespace = " . NS_MAIN
. "
52 GROUP BY page_namespace, page_title
57 function formatResult( $skin, $result ) {
59 $title = Title
::makeTitleSafe( $result->namespace, $result->title
);
61 $count = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value
) );
62 $link = $skin->link( $title );
63 return wfSpecialList( $link, $count );
70 function wfSpecialMostcategories() {
71 list( $limit, $offset ) = wfCheckLimits();
73 $wpp = new MostcategoriesPage();
75 $wpp->doQuery( $offset, $limit );