79e3dc6be45f49c751bb61b81e9838786cdaaa5f
3 * A querypage to list the most wanted categories - implements Special:Wantedcategories
5 * @addtogroup SpecialPage
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
11 class WantedCategoriesPage
extends QueryPage
{
14 return 'Wantedcategories';
17 function isExpensive() {
21 function isSyndicated() {
26 $dbr = wfGetDB( DB_SLAVE
);
27 list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
28 $name = $dbr->addQuotes( $this->getName() );
33 " . NS_CATEGORY
. " as namespace,
37 LEFT JOIN $page ON cl_to = page_title AND page_namespace = ". NS_CATEGORY
."
38 WHERE page_title IS NULL
43 function sortDescending() { return true; }
46 * Fetch user page links and cache their existence
48 function preprocessResults( $db, $res ) {
49 $batch = new LinkBatch
;
50 while ( $row = $db->fetchObject( $res ) )
51 $batch->add( $row->namespace, $row->title
);
54 // Back to start for display
55 if ( $db->numRows( $res ) > 0 )
56 // If there are no rows we get an error seeking.
57 $db->dataSeek( $res, 0 );
60 function formatResult( $skin, $result ) {
61 global $wgLang, $wgContLang;
63 $nt = Title
::makeTitle( $result->namespace, $result->title
);
64 $text = $wgContLang->convert( $nt->getText() );
66 $plink = $this->isCached() ?
67 $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) :
68 $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
70 $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
71 $wgLang->formatNum( $result->value
) );
72 return wfSpecialList($plink, $nlinks);
79 function wfSpecialWantedCategories() {
80 list( $limit, $offset ) = wfCheckLimits();
82 $wpp = new WantedCategoriesPage();
84 $wpp->doQuery( $offset, $limit );