Use Doxygen @addtogroup instead of phpdoc @package && @subpackage
[lhc/web/wiklou.git] / includes / SpecialWantedcategories.php
1 <?php
2 /**
3 * A querypage to list the most wanted categories
4 *
5 * @addtogroup SpecialPage
6 *
7 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
8 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
9 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
10 */
11
12 /**
13 * @addtogroup SpecialPage
14 */
15 class WantedCategoriesPage extends QueryPage {
16
17 function getName() { return 'Wantedcategories'; }
18 function isExpensive() { return true; }
19 function isSyndicated() { return false; }
20
21 function getSQL() {
22 $dbr =& wfGetDB( DB_SLAVE );
23 list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
24 $name = $dbr->addQuotes( $this->getName() );
25 return
26 "
27 SELECT
28 $name as type,
29 " . NS_CATEGORY . " as namespace,
30 cl_to as title,
31 COUNT(*) as value
32 FROM $categorylinks
33 LEFT JOIN $page ON cl_to = page_title AND page_namespace = ". NS_CATEGORY ."
34 WHERE page_title IS NULL
35 GROUP BY 1,2,3
36 ";
37 }
38
39 function sortDescending() { return true; }
40
41 /**
42 * Fetch user page links and cache their existence
43 */
44 function preprocessResults( &$db, &$res ) {
45 $batch = new LinkBatch;
46 while ( $row = $db->fetchObject( $res ) )
47 $batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
48 $batch->execute();
49
50 // Back to start for display
51 if ( $db->numRows( $res ) > 0 )
52 // If there are no rows we get an error seeking.
53 $db->dataSeek( $res, 0 );
54 }
55
56 function formatResult( $skin, $result ) {
57 global $wgLang, $wgContLang;
58
59 $nt = Title::makeTitle( $result->namespace, $result->title );
60 $text = $wgContLang->convert( $nt->getText() );
61
62 $plink = $this->isCached() ?
63 $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) :
64 $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
65
66 $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
67 $wgLang->formatNum( $result->value ) );
68 return wfSpecialList($plink, $nlinks);
69 }
70 }
71
72 /**
73 * constructor
74 */
75 function wfSpecialWantedCategories() {
76 list( $limit, $offset ) = wfCheckLimits();
77
78 $wpp = new WantedCategoriesPage();
79
80 $wpp->doQuery( $offset, $limit );
81 }
82
83 ?>