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