Fix disambiguation page that were never properly migrated from 1.4
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 10 Jul 2005 17:38:38 +0000 (17:38 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 10 Jul 2005 17:38:38 +0000 (17:38 +0000)
mysql> explain 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 = 4
       AND pb.page_title = 'Liens_aux_pages_d\'homonymie'
       AND lb.pl_title = pb.page_title
       AND pa.page_id = lb.pl_from
       AND la.pl_title = pa.page_title;
---+------+----------+----------+-----+-----------+----+--------------+
tab|type  |possible k|key       |k_len|ref        |rows|Extra         |
---+------+----------+----------+-----+-----------+----+--------------+
pb |const |name_title|name_title|  259|const,const|   1|index         |
la |index |NULL      |pl_from   |  263|NULL       |1976|index         |
lb |index |pl_from   |pl_from   |  263|NULL       |1976|where & index |
pa |eq_ref|PRIMARY   |PRIMARY   |    4|lb.pl_from |   1|where         |
---+------+----------+----------+-----+-----------+----+--------------+

RELEASE-NOTES
includes/SpecialDisambiguations.php

index edca29b..2617e12 100644 (file)
@@ -554,7 +554,7 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new.
 * Fix nohistory message on empty page history
 * Fix fatal error in history when validation on
 * Cleaned up email notification message formatting
-
+* Finally fixed Special:Disambiguations that was broke since SCHEMA_WORK
 
 === Caveats ===
 
index 10a3294..69474c7 100644 (file)
@@ -42,12 +42,14 @@ class DisambiguationsPage extends PageQueryPage {
         $dtitle = $dbr->addQuotes( $dp->getDBkey() );
 
                $sql = "SELECT 'Disambiguations' as type,"
-            .        " pl_namespace AS namespace, pl_title AS title"
-                   . " FROM {$pagelinks}, {$page}"
-                   . " WHERE page_namespace = $dns"
-            . " AND page_title = $dtitle"
-                   . " AND pl_from=page_id";
-
+                       . "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
                return $sql;
        }
 
@@ -57,8 +59,8 @@ class DisambiguationsPage extends PageQueryPage {
        
        function formatResult( $skin, $result ) {
                global $wgContLang ;
-               $dp = Title::newFromText(wfMsgForContent("disambiguationspage"));
-        $title = Title::makeTitle( $result->namespace, $result->title );
+               $title = Title::newFromId( $result->link_from );
+        $dp = Title::makeTitle( $result->namespace, $result->title );
 
                $from = $skin->makeKnownLinkObj( $title,'');
                $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
@@ -77,6 +79,5 @@ function wfSpecialDisambiguations() {
        $sd = new DisambiguationsPage();
        
        return $sd->doQuery( $offset, $limit );
-
 }
 ?>