5 * @subpackage SpecialPage
11 require_once 'QueryPage.php';
16 * @subpackage SpecialPage
18 class WantedPagesPage
extends QueryPage
{
19 function WantedPagesPage( $inc = false ) {
20 $this->setListoutput( $inc );
27 function isExpensive() {
30 function isSyndicated() { return false; }
33 $dbr =& wfGetDB( DB_SLAVE
);
34 $pagelinks = $dbr->tableName( 'pagelinks' );
35 $page = $dbr->tableName( 'page' );
37 "SELECT 'Wantedpages' AS type,
38 pl_namespace AS namespace,
43 ON pl_namespace=page_namespace AND pl_title=page_title
44 WHERE page_namespace IS NULL
45 GROUP BY pl_namespace,pl_title
50 * Fetch user page links and cache their existence
52 function preprocessResults( &$db, &$res ) {
55 $batch = new LinkBatch
;
56 while ( $row = $db->fetchObject( $res ) )
57 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->title
) );
58 $batch->execute( $wgLinkCache );
60 // Back to start for display
61 if ( $db->numRows( $res ) > 0 )
62 // If there are no rows we get an error seeking.
63 $db->dataSeek( $res, 0 );
67 function formatResult( $skin, $result ) {
70 $nt = Title
::makeTitle( $result->namespace, $result->title
);
71 $text = $wgContLang->convert( $nt->getPrefixedText() );
72 $plink = $this->isCached() ?
73 $skin->makeLinkObj( $nt, $text ) :
74 $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
76 $nl = wfMsg( 'nlinks', $result->value
);
77 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() );
79 return "$plink ($nlink)";
86 function wfSpecialWantedpages( $par = null, $specialPage ) {
87 $inc = $specialPage->including();
93 list( $limit, $offset ) = wfCheckLimits();
95 $wpp = new WantedPagesPage( $inc );
97 $wpp->doQuery( $offset, $limit, !$inc );