5 * @subpackage SpecialPage
11 require_once 'QueryPage.php';
16 * @subpackage SpecialPage
18 class WantedPagesPage
extends QueryPage
{
21 function WantedPagesPage( $inc = false, $nlinks = true ) {
22 $this->setListoutput( $inc );
23 $this->nlinks
= $nlinks;
30 function isExpensive() {
33 function isSyndicated() { return false; }
36 $dbr =& wfGetDB( DB_SLAVE
);
37 $pagelinks = $dbr->tableName( 'pagelinks' );
38 $page = $dbr->tableName( 'page' );
40 "SELECT 'Wantedpages' AS type,
41 pl_namespace AS namespace,
46 ON pl_namespace=page_namespace AND pl_title=page_title
47 WHERE page_namespace IS NULL
48 GROUP BY pl_namespace,pl_title
53 * Fetch user page links and cache their existence
55 function preprocessResults( &$db, &$res ) {
58 $batch = new LinkBatch
;
59 while ( $row = $db->fetchObject( $res ) )
60 $batch->addObj( Title
::makeTitleSafe( $row->namespace, $row->title
) );
61 $batch->execute( $wgLinkCache );
63 // Back to start for display
64 if ( $db->numRows( $res ) > 0 )
65 // If there are no rows we get an error seeking.
66 $db->dataSeek( $res, 0 );
70 function formatResult( $skin, $result ) {
73 $nt = Title
::makeTitle( $result->namespace, $result->title
);
74 $text = $wgContLang->convert( $nt->getPrefixedText() );
75 $plink = $this->isCached() ?
76 $skin->makeLinkObj( $nt, $text ) :
77 $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
79 $nl = wfMsg( 'nlinks', $result->value
);
80 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() );
82 return $this->nlinks ?
"$plink ($nlink)" : $plink;
89 function wfSpecialWantedpages( $par = null, $specialPage ) {
90 $inc = $specialPage->including();
93 @list
( $limit, $nlinks ) = explode( '/', $par, 2 );
95 $nlinks = $nlinks === 'nlinks';
98 list( $limit, $offset ) = wfCheckLimits();
102 $wpp = new WantedPagesPage( $inc, $nlinks );
104 $wpp->doQuery( $offset, $limit, !$inc );