Changing comments layout preparing for generated documentation with Phpdocumentor
[lhc/web/wiklou.git] / includes / SpecialWantedpages.php
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 require_once ( 'QueryPage.php' ) ;
10
11 /**
12 *
13 */
14 class WantedPagesPage extends QueryPage {
15
16 function getName() {
17 return 'Wantedpages';
18 }
19
20 function isExpensive() {
21 return true;
22 }
23
24 function getSQL() {
25 $dbr =& wfGetDB( DB_SLAVE );
26 $brokenlinks = $dbr->tableName( 'brokenlinks' );
27
28 # We cheat and return the full-text from bl_to in the title.
29 # In the future, a pre-parsed name will be available.
30 return
31 "SELECT 'Wantedpages' as type,
32 0 as namespace,
33 bl_to as title,
34 COUNT(DISTINCT bl_from) as value
35 FROM $brokenlinks
36 GROUP BY bl_to
37 HAVING value > 1";
38 }
39
40 function formatResult( $skin, $result ) {
41 global $wgLang;
42
43 $nt = Title::newFromDBkey( $result->title );
44 if( is_null( $nt ) ) {
45 return "<!-- Bad title '" . htmlspecialchars( $result->title ) . "' -->";
46 }
47 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), "" );
48 $nl = wfMsg( "nlinks", $result->value );
49 $nlink = $skin->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ), $nl,
50 "target=" . $nt->getPrefixedURL() );
51
52 return "{$plink} ({$nlink})";
53 }
54 }
55
56 /**
57 * constructor
58 */
59 function wfSpecialWantedpages() {
60 list( $limit, $offset ) = wfCheckLimits();
61
62 $wpp = new WantedPagesPage();
63
64 $wpp->doQuery( $offset, $limit );
65 }
66
67 ?>