* @subpackage Parser
[lhc/web/wiklou.git] / includes / SpecialDoubleRedirects.php
index 1c98a05..cc044f1 100644 (file)
@@ -1,30 +1,45 @@
 <?php
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 
+/**
+ * 
+ */
 require_once('QueryPage.php');
 
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 class DoubleRedirectsPage extends PageQueryPage {
 
        function getName() {
-               return 'doubleredirects';
+               return 'DoubleRedirects';
        }
        
        function isExpensive( ) { return true; }
+       function isSyndicated() { return false; }
 
        function getPageHeader( ) {
                #FIXME : probably need to add a backlink to the maintenance page.
-               return '<p>'.wfMsg("doubleredirectstext")."</p><br>\n";
+               return '<p>'.wfMsg("doubleredirectstext")."</p><br />\n";
        }
 
        function getSQL() {
                $dbr =& wfGetDB( DB_SLAVE );
-               extract( $dbr->tableNames( 'cur', 'links' ) );
-
-               $sql = "SELECT ca.cur_namespace as ns_a, ca.cur_title as title_a," . 
-                          "  cb.cur_namespace as ns_b, cb.cur_title as title_b," .
-                          "  cb.cur_text AS rt " . 
-                          "FROM $links,$cur AS ca,$cur AS cb ". 
-                          "WHERE ca.cur_is_redirect=1 AND cb.cur_is_redirect=1 AND l_to=cb.cur_id " .
-                          "  AND l_from=ca.cur_id " ;
+               extract( $dbr->tableNames( 'page', 'links', 'text' ) );
+
+               $sql = "SELECT pa.page_namespace as ns_a, pa.page_title as title_a,
+                            pb.page_namespace as ns_b, pb.page_title as title_b,
+                            old_text AS rt 
+                          FROM $text AS t, $links,$page AS pa,$page AS pb 
+                          WHERE pa.page_is_redirect=1 AND pb.page_is_redirect=1 AND l_to=pb.page_id 
+                            AND l_from=pa.page_id 
+                            AND pb.page_latest=t.old_id" ;
                return $sql;
        }
 
@@ -33,8 +48,8 @@ class DoubleRedirectsPage extends PageQueryPage {
        }
        
        function formatResult( $skin, $result ) {
-               global $wgLang ;
-               $ns = $wgLang->getNamespaces() ;
+               global $wgContLang ;
+               $ns = $wgContLang->getNamespaces() ;
                $from = $skin->makeKnownLink( $ns[$result->ns_a].':'.$result->title_a ,'', 'redirect=no' );
                $edit = $skin->makeBrokenLink( $ns[$result->ns_a].':'.$result->title_a , "(".wfMsg("qbedit").")" , 'redirect=no');
                $to   = $skin->makeKnownLink( $ns[$result->ns_b].':'.$result->title_b ,'');
@@ -44,6 +59,9 @@ class DoubleRedirectsPage extends PageQueryPage {
        }
 }
 
+/**
+ * constructor
+ */
 function wfSpecialDoubleRedirects() {
        list( $limit, $offset ) = wfCheckLimits();