1a6e8a579914c1881ca26cbb834bf41573c5fecb
[lhc/web/wiklou.git] / includes / SpecialWantedpages.php
1 <?php
2
3 include_once ( "QueryPage.php" ) ;
4
5 class WantedPagesPage extends QueryPage {
6
7 function getName() {
8 return "Wantedpages";
9 }
10
11 function isExpensive() {
12 return 1;
13 }
14
15 function getSQL( $offset, $limit ) {
16 return "SELECT bl_to, COUNT( DISTINCT bl_from ) as nlinks " .
17 "FROM brokenlinks GROUP BY bl_to HAVING nlinks > 1 " .
18 "ORDER BY nlinks DESC LIMIT {$offset}, {$limit}";
19 }
20
21 function formatResult( $skin, $result ) {
22 global $wgLang;
23
24 $nt = Title::newFromDBkey( $result->bl_to );
25
26 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), "" );
27 $nl = wfMsg( "nlinks", $result->nlinks );
28 $nlink = $skin->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ), $nl,
29 "target=" . $nt->getPrefixedURL() );
30
31 return "{$plink} ({$nlink})";
32 }
33 }
34
35 function wfSpecialWantedpages()
36 {
37 list( $limit, $offset ) = wfCheckLimits();
38
39 $wpp = new WantedPagesPage();
40
41 $wpp->doQuery( $offset, $limit );
42 }
43
44 ?>