Capitalization fix in memcached setting
[lhc/web/wiklou.git] / includes / SpecialWantedpages.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 require_once ( 'QueryPage.php' ) ;
12
13 /**
14 *
15 * @package MediaWiki
16 * @subpackage SpecialPage
17 */
18 class WantedPagesPage extends QueryPage {
19
20 function getName() {
21 return 'Wantedpages';
22 }
23
24 function isExpensive() {
25 return true;
26 }
27 function isSyndicated() { return false; }
28
29 function getSQL() {
30 $dbr =& wfGetDB( DB_SLAVE );
31 $brokenlinks = $dbr->tableName( 'brokenlinks' );
32
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
44 ORDER BY $agrvalue ".
45 ($this->sortDescending() ? 'DESC' : '');
46 }
47
48 function getOrder() {
49 return '';
50 }
51
52 function formatResult( $skin, $result ) {
53 global $wgContLang;
54
55 $nt = Title::newFromDBkey( $result->title );
56 if( is_null( $nt ) ) {
57 return "<!-- Bad title '" . htmlspecialchars( $result->title ) . "' -->";
58 }
59 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), "" );
60 $nl = wfMsg( "nlinks", $result->value );
61 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl,
62 "target=" . $nt->getPrefixedURL() );
63
64 return "{$plink} ({$nlink})";
65 }
66 }
67
68 /**
69 * constructor
70 */
71 function wfSpecialWantedpages() {
72 list( $limit, $offset ) = wfCheckLimits();
73
74 $wpp = new WantedPagesPage();
75
76 $wpp->doQuery( $offset, $limit );
77 }
78
79 ?>