5 * @subpackage SpecialPage
8 require_once ( 'QueryPage.php' ) ;
13 * @subpackage SpecialPage
15 class MostlinkedPage
extends QueryPage
{
17 function getName() { return 'Mostlinked'; }
18 function isExpensive() { return true; }
19 function isSyndicated() { return false; }
22 $dbr =& wfGetDB( DB_SLAVE
);
23 extract( $dbr->tableNames( 'pagelinks', 'page' ) );
25 "SELECT 'Mostlinked' AS type,
26 pl_namespace AS namespace,
29 -- FIXME: The presence of this is a bug
32 LEFT JOIN $page ON pl_namespace=page_namespace AND pl_title=page_title
33 GROUP BY pl_namespace,pl_title
37 function formatResult( $skin, $result ) {
40 $nt = Title
::makeTitle( $result->namespace, $result->title
);
41 $text = $wgContLang->convert( $nt->getPrefixedText() );
42 if ( is_null( $result->page_namespace
) )
43 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
45 $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
47 $nl = wfMsg( "nlinks", $result->value
);
48 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl, "target=" . $nt->getPrefixedURL() );
50 return "{$plink} ({$nlink})";
57 function wfSpecialMostlinked() {
58 list( $limit, $offset ) = wfCheckLimits();
60 $wpp = new MostlinkedPage();
62 $wpp->doQuery( $offset, $limit );