* Fixed some phpdoc errors, see http://wikipedia.sf.net/doc/errors.html
[mediawiki.git] / includes / SpecialWantedpages.php
blob1cbd8bb9fc0a4795ed1892253a7a292ac4f8488d
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;
27 function isSyndicated() { return false; }
29 function getSQL() {
30 $dbr =& wfGetDB( DB_SLAVE );
31 $brokenlinks = $dbr->tableName( 'brokenlinks' );
33 # We cheat and return the full-text from bl_to in the title.
34 # In the future, a pre-parsed name will be available.
35 $agrvalue=$dbr->aggregateValue('COUNT(DISTINCT bl_from)');
36 return
37 "SELECT 'Wantedpages' as type,
38 0 as namespace,
39 bl_to as title,
40 COUNT(DISTINCT bl_from) as value
41 FROM $brokenlinks
42 GROUP BY bl_to
43 HAVING $agrvalue > 1";
46 function formatResult( $skin, $result ) {
47 global $wgContLang;
49 $nt = Title::newFromDBkey( $result->title );
50 $text = $wgContLang->convert( $result->title );
51 if( is_null( $nt ) ) {
52 return "<!-- Bad title '" . htmlspecialchars( $result->title ) . "' -->";
54 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
55 $nl = wfMsg( "nlinks", $result->value );
56 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl,
57 "target=" . $nt->getPrefixedURL() );
59 return "{$plink} ({$nlink})";
63 /**
64 * constructor
66 function wfSpecialWantedpages() {
67 list( $limit, $offset ) = wfCheckLimits();
69 $wpp = new WantedPagesPage();
71 $wpp->doQuery( $offset, $limit );