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