* Moved content from liveCmdLine.inc into commandLine.inc, obsoleting the former.
[mediawiki.git] / includes / SpecialWantedpages.php
blobbf2d630096e5e515d9192d343b04aff163921cf3
1 <?php
3 require_once ( "QueryPage.php" ) ;
5 class WantedPagesPage extends QueryPage {
7 function getName() {
8 return "Wantedpages";
11 function isExpensive() {
12 return true;
15 function getSQL() {
16 # We cheat and return the full-text from bl_to in the title.
17 # In the future, a pre-parsed name will be available.
18 return
19 "SELECT 'Wantedpages' as type,
20 0 as namespace,
21 bl_to as title,
22 COUNT(DISTINCT bl_from) as value
23 FROM brokenlinks
24 GROUP BY bl_to
25 HAVING value > 1";
28 function formatResult( $skin, $result ) {
29 global $wgLang;
31 $nt = Title::newFromDBkey( $result->title );
32 if( is_null( $nt ) ) {
33 return "<!-- Bad title '" . htmlspecialchars( $result->title ) . "' -->";
35 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), "" );
36 $nl = wfMsg( "nlinks", $result->value );
37 $nlink = $skin->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ), $nl,
38 "target=" . $nt->getPrefixedURL() );
40 return "{$plink} ({$nlink})";
44 function wfSpecialWantedpages()
46 list( $limit, $offset ) = wfCheckLimits();
48 $wpp = new WantedPagesPage();
50 $wpp->doQuery( $offset, $limit );