* double quotes to single quotes
[mediawiki.git] / includes / SpecialWantedpages.php
blobaece6c6d4fd1283f9bfbe73858e181d39c150712
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
11 require_once ( 'QueryPage.php' ) ;
13 /**
15 * @package MediaWiki
16 * @subpackage SpecialPage
18 class WantedPagesPage extends QueryPage {
20 function getName() {
21 return 'Wantedpages';
24 function isExpensive() {
25 return true;
28 function getSQL() {
29 $dbr =& wfGetDB( DB_SLAVE );
30 $brokenlinks = $dbr->tableName( 'brokenlinks' );
32 # We cheat and return the full-text from bl_to in the title.
33 # In the future, a pre-parsed name will be available.
34 return
35 "SELECT 'Wantedpages' as type,
36 0 as namespace,
37 bl_to as title,
38 COUNT(DISTINCT bl_from) as value
39 FROM $brokenlinks
40 GROUP BY bl_to
41 HAVING value > 1";
44 function formatResult( $skin, $result ) {
45 global $wgLang;
47 $nt = Title::newFromDBkey( $result->title );
48 if( is_null( $nt ) ) {
49 return "<!-- Bad title '" . htmlspecialchars( $result->title ) . "' -->";
51 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), "" );
52 $nl = wfMsg( "nlinks", $result->value );
53 $nlink = $skin->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ), $nl,
54 "target=" . $nt->getPrefixedURL() );
56 return "{$plink} ({$nlink})";
60 /**
61 * constructor
63 function wfSpecialWantedpages() {
64 list( $limit, $offset ) = wfCheckLimits();
66 $wpp = new WantedPagesPage();
68 $wpp->doQuery( $offset, $limit );