(bug 4974) Don't follow redirected talk page on "new messages" link
[lhc/web/wiklou.git] / includes / SpecialDoubleRedirects.php
index 9c0563e..9dea932 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /**
- * 
+ *
  */
 require_once('QueryPage.php');
 
@@ -20,7 +20,7 @@ class DoubleRedirectsPage extends PageQueryPage {
        function getName() {
                return 'DoubleRedirects';
        }
-       
+
        function isExpensive( ) { return true; }
        function isSyndicated() { return false; }
 
@@ -31,43 +31,47 @@ class DoubleRedirectsPage extends PageQueryPage {
 
        function getSQL() {
                $dbr =& wfGetDB( DB_SLAVE );
-               extract( $dbr->tableNames( 'page', 'links' ) );
+               extract( $dbr->tableNames( 'page', 'pagelinks' ) );
 
                $sql = "SELECT 'DoubleRedirects' as type," .
                         " pa.page_namespace as namespace, pa.page_title as title," .
                             " pb.page_namespace as nsb, pb.page_title as tb," .
                                 " pc.page_namespace as nsc, pc.page_title as tc" .
-                          " FROM $links AS la, $links AS lb, $page AS pa, $page AS pb, $page AS pc" .
+                          " FROM $pagelinks AS la, $pagelinks AS lb, $page AS pa, $page AS pb, $page AS pc" .
                           " WHERE pa.page_is_redirect=1 AND pb.page_is_redirect=1" .
-                            " AND la.l_from=pa.page_id" .
-                                " AND la.l_to=pb.page_id" .
-                                " AND lb.l_from=pb.page_id" .
-                                " AND lb.l_to=pc.page_id";
+                            " AND la.pl_from=pa.page_id" .
+                                " AND la.pl_namespace=pb.page_namespace" .
+                                " AND la.pl_title=pb.page_title" .
+                                " AND lb.pl_from=pb.page_id" .
+                                " AND lb.pl_namespace=pc.page_namespace" .
+                                " AND lb.pl_title=pc.page_title";
                return $sql;
        }
 
        function getOrder() {
                return '';
        }
-       
+
        function formatResult( $skin, $result ) {
                $fname = 'DoubleRedirectsPage::formatResult';
                $titleA = Title::makeTitle( $result->namespace, $result->title );
 
                if ( $result && !isset( $result->nsb ) ) {
                        $dbr =& wfGetDB( DB_SLAVE );
-                       extract( $dbr->tableNames( 'page', 'links' ) );
+                       extract( $dbr->tableNames( 'page', 'pagelinks' ) );
                        $encTitle = $dbr->addQuotes( $result->title );
 
                        $sql = "SELECT pa.page_namespace as namespace, pa.page_title as title," .
                                         " pb.page_namespace as nsb, pb.page_title as tb," .
                                         " pc.page_namespace as nsc, pc.page_title as tc" .
-                                  " FROM $links AS la, $links AS lb, $page AS pa, $page AS pb, $page AS pc" .
+                                  " FROM $pagelinks AS la, $pagelinks AS lb, $page AS pa, $page AS pb, $page AS pc" .
                                   " WHERE pa.page_is_redirect=1 AND pb.page_is_redirect=1" .
-                                        " AND la.l_from=pa.page_id" .
-                                        " AND la.l_to=pb.page_id" .
-                                        " AND lb.l_from=pb.page_id" .
-                                        " AND lb.l_to=pc.page_id" .
+                                        " AND la.pl_from=pa.page_id" .
+                                        " AND la.pl_namespace=pb.page_namespace" .
+                                        " AND la.pl_title=pb.page_title" .
+                                        " AND lb.pl_from=pb.page_id" .
+                                        " AND lb.pl_namespace=pc.page_namespace" .
+                                        " AND lb.pl_title=pc.page_title" .
                                         " AND pa.page_namespace={$result->namespace}" .
                                         " AND pa.page_title=$encTitle";
                        $res = $dbr->query( $sql, $fname );
@@ -78,7 +82,7 @@ class DoubleRedirectsPage extends PageQueryPage {
                if ( !$result ) {
                        return '';
                }
-               
+
                $titleB = Title::makeTitle( $result->nsb, $result->tb );
                $titleC = Title::makeTitle( $result->nsc, $result->tc );
 
@@ -86,8 +90,9 @@ class DoubleRedirectsPage extends PageQueryPage {
                $edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
                $linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' );
                $linkC = $skin->makeKnownLinkObj( $titleC );
-               
-               return "$linkA $edit → $linkB → $linkC";
+
+               return "$linkA $edit " . wfMsgHtml( 'doubleredirectsarrow' )
+                       . " $linkB " . wfMsgHtml( 'doubleredirectsarrow' ) . " $linkC";
        }
 }
 
@@ -96,9 +101,9 @@ class DoubleRedirectsPage extends PageQueryPage {
  */
 function wfSpecialDoubleRedirects() {
        list( $limit, $offset ) = wfCheckLimits();
-       
+
        $sdr = new DoubleRedirectsPage();
-       
+
        return $sdr->doQuery( $offset, $limit );
 
 }