sync from fr.wikipedia.org
[lhc/web/wiklou.git] / includes / SpecialDisambiguations.php
index e141a29..b8f4ba3 100644 (file)
@@ -41,15 +41,13 @@ class DisambiguationsPage extends PageQueryPage {
         $dns = $dp->getNamespace();
         $dtitle = $dbr->addQuotes( $dp->getDBkey() );
 
-               $sql = "SELECT 'Disambiguations' as type,"
-                       . "la.pl_namespace AS namespace, la.pl_title AS title, la.pl_from AS link_from"
-                   . " FROM {$pagelinks} AS la, {$pagelinks} AS lb,"
-                       .      " {$page} AS pa, {$page} AS pb"
-                   . " WHERE pb.page_namespace = $dns"
-            . " AND pb.page_title = $dtitle"      # disambiguation pages
-                       . " AND lb.pl_title = pb.page_title"  # title of pages that are disamb
-                       . " AND pa.page_id = lb.pl_from"      # id of page poiting to a disamb
-                       . " AND la.pl_title = pa.page_title"; # title of those
+               $sql = "SELECT 'Disambiguations' AS type, pa.page_namespace AS namespace,"
+                        ." pa.page_title AS title, la.pl_from AS value"
+                        ." FROM {$pagelinks} AS lb, {$page} AS pa, {$pagelinks} AS la"
+                        ." WHERE lb.pl_namespace = $dns AND lb.pl_title = $dtitle" # disambiguation template
+                        ." AND pa.page_id = lb.pl_from"        
+                        ." AND pa.page_namespace = la.pl_namespace"
+                        ." AND pa.page_title = la.pl_title";
                return $sql;
        }
 
@@ -59,7 +57,7 @@ class DisambiguationsPage extends PageQueryPage {
        
        function formatResult( $skin, $result ) {
                global $wgContLang ;
-               $title = Title::newFromId( $result->link_from );
+               $title = Title::newFromId( $result->value );
         $dp = Title::makeTitle( $result->namespace, $result->title );
 
                $from = $skin->makeKnownLinkObj( $title,'');