Sorry I forgot to commit the fix...
[lhc/web/wiklou.git] / includes / SpecialDoubleRedirects.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 DoubleRedirectsPage extends PageQueryPage {
19
20 function getName() {
21 return 'doubleredirects';
22 }
23
24 function isExpensive( ) { return true; }
25
26 function getPageHeader( ) {
27 #FIXME : probably need to add a backlink to the maintenance page.
28 return '<p>'.wfMsg("doubleredirectstext")."</p><br>\n";
29 }
30
31 function getSQL() {
32 $dbr =& wfGetDB( DB_SLAVE );
33 extract( $dbr->tableNames( 'cur', 'links' ) );
34
35 $sql = "SELECT ca.cur_namespace as ns_a, ca.cur_title as title_a," .
36 " cb.cur_namespace as ns_b, cb.cur_title as title_b," .
37 " cb.cur_text AS rt " .
38 "FROM $links,$cur AS ca,$cur AS cb ".
39 "WHERE ca.cur_is_redirect=1 AND cb.cur_is_redirect=1 AND l_to=cb.cur_id " .
40 " AND l_from=ca.cur_id " ;
41 return $sql;
42 }
43
44 function getOrder() {
45 return '';
46 }
47
48 function formatResult( $skin, $result ) {
49 global $wgLang ;
50 $ns = $wgLang->getNamespaces() ;
51 $from = $skin->makeKnownLink( $ns[$result->ns_a].':'.$result->title_a ,'', 'redirect=no' );
52 $edit = $skin->makeBrokenLink( $ns[$result->ns_a].':'.$result->title_a , "(".wfMsg("qbedit").")" , 'redirect=no');
53 $to = $skin->makeKnownLink( $ns[$result->ns_b].':'.$result->title_b ,'');
54 $content = $result->rt;
55
56 return "$from $edit => $to ($content)";
57 }
58 }
59
60 /**
61 * constructor
62 */
63 function wfSpecialDoubleRedirects() {
64 list( $limit, $offset ) = wfCheckLimits();
65
66 $sdr = new DoubleRedirectsPage();
67
68 return $sdr->doQuery( $offset, $limit );
69
70 }
71 ?>