Merge "Protected function UploadBase->validateName changed to public"
[lhc/web/wiklou.git] / includes / specials / SpecialWantedcategories.php
1 <?php
2 /**
3 * Implements Special:Wantedcategories
4 *
5 * Copyright © 2005 Ævar Arnfjörð Bjarmason
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
21 *
22 * @file
23 * @ingroup SpecialPage
24 */
25
26 /**
27 * A querypage to list the most wanted categories - implements Special:Wantedcategories
28 *
29 * @ingroup SpecialPage
30 */
31 class WantedCategoriesPage extends WantedQueryPage {
32
33 function __construct( $name = 'Wantedcategories' ) {
34 parent::__construct( $name );
35 }
36
37 function getQueryInfo() {
38 return array (
39 'tables' => array ( 'categorylinks', 'page' ),
40 'fields' => array ( 'namespace' => NS_CATEGORY,
41 'title' => 'cl_to',
42 'value' => 'COUNT(*)' ),
43 'conds' => array ( 'page_title IS NULL' ),
44 'options' => array ( 'GROUP BY' => 'cl_to' ),
45 'join_conds' => array ( 'page' => array ( 'LEFT JOIN',
46 array ( 'page_title = cl_to',
47 'page_namespace' => NS_CATEGORY ) ) )
48 );
49 }
50
51 /**
52 * @param $skin Skin
53 * @param $result
54 * @return string
55 */
56 function formatResult( $skin, $result ) {
57 global $wgContLang;
58
59 $nt = Title::makeTitle( $result->namespace, $result->title );
60 $text = htmlspecialchars( $wgContLang->convert( $nt->getText() ) );
61
62 $plink = $this->isCached() ?
63 Linker::link( $nt, $text ) :
64 Linker::link(
65 $nt,
66 $text,
67 array(),
68 array(),
69 array( 'broken' )
70 );
71
72 $nlinks = $this->msg( 'nmembers' )->numParams( $result->value )->escaped();
73 return $this->getLanguage()->specialList( $plink, $nlinks );
74 }
75
76 protected function getGroupName() {
77 return 'maintenance';
78 }
79 }