Changing comments layout preparing for generated documentation with Phpdocumentor
[lhc/web/wiklou.git] / includes / SpecialDoubleRedirects.php
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 require_once('QueryPage.php');
10
11 /**
12 *
13 */
14 class DoubleRedirectsPage extends PageQueryPage {
15
16 function getName() {
17 return 'doubleredirects';
18 }
19
20 function isExpensive( ) { return true; }
21
22 function getPageHeader( ) {
23 #FIXME : probably need to add a backlink to the maintenance page.
24 return '<p>'.wfMsg("doubleredirectstext")."</p><br>\n";
25 }
26
27 function getSQL() {
28 $dbr =& wfGetDB( DB_SLAVE );
29 extract( $dbr->tableNames( 'cur', 'links' ) );
30
31 $sql = "SELECT ca.cur_namespace as ns_a, ca.cur_title as title_a," .
32 " cb.cur_namespace as ns_b, cb.cur_title as title_b," .
33 " cb.cur_text AS rt " .
34 "FROM $links,$cur AS ca,$cur AS cb ".
35 "WHERE ca.cur_is_redirect=1 AND cb.cur_is_redirect=1 AND l_to=cb.cur_id " .
36 " AND l_from=ca.cur_id " ;
37 return $sql;
38 }
39
40 function getOrder() {
41 return '';
42 }
43
44 function formatResult( $skin, $result ) {
45 global $wgLang ;
46 $ns = $wgLang->getNamespaces() ;
47 $from = $skin->makeKnownLink( $ns[$result->ns_a].':'.$result->title_a ,'', 'redirect=no' );
48 $edit = $skin->makeBrokenLink( $ns[$result->ns_a].':'.$result->title_a , "(".wfMsg("qbedit").")" , 'redirect=no');
49 $to = $skin->makeKnownLink( $ns[$result->ns_b].':'.$result->title_b ,'');
50 $content = $result->rt;
51
52 return "$from $edit => $to ($content)";
53 }
54 }
55
56 /**
57 * constructor
58 */
59 function wfSpecialDoubleRedirects() {
60 list( $limit, $offset ) = wfCheckLimits();
61
62 $sdr = new DoubleRedirectsPage();
63
64 return $sdr->doQuery( $offset, $limit );
65
66 }
67 ?>