Index: trunk/phase3/includes/SpecialDisambiguations.php |
— | — | @@ -29,25 +29,31 @@ |
30 | 30 | $sk = $wgUser->getSkin(); |
31 | 31 | |
32 | 32 | #FIXME : probably need to add a backlink to the maintenance page. |
33 | | - return '<p>'.wfMsg("disambiguationstext", $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n"; |
| 33 | + return '<p>'.wfMsg('disambiguationstext', $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n"; |
34 | 34 | } |
35 | 35 | |
36 | 36 | function getSQL() { |
37 | 37 | $dbr =& wfGetDB( DB_SLAVE ); |
38 | | - extract( $dbr->tableNames( 'page', 'pagelinks' ) ); |
| 38 | + extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) ); |
39 | 39 | |
40 | | - $dp = Title::newFromText(wfMsgForContent("disambiguationspage")); |
| 40 | + $dp = Title::newFromText(wfMsgForContent('disambiguationspage')); |
41 | 41 | $id = $dp->getArticleId(); |
42 | 42 | $dns = $dp->getNamespace(); |
43 | 43 | $dtitle = $dbr->addQuotes( $dp->getDBkey() ); |
44 | 44 | |
45 | | - $sql = "SELECT 'Disambiguations' AS type, pa.page_namespace AS namespace," |
| 45 | + if($dns != NS_TEMPLATE) { |
| 46 | + # FIXME we assume the disambiguation message is a template but |
| 47 | + # the page can potentially be from another namespace :/ |
| 48 | + wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n"); |
| 49 | + } |
| 50 | + |
| 51 | + $sql = "SELECT 'Disambiguations' AS 'type', pa.page_namespace AS namespace," |
46 | 52 | ." pa.page_title AS title, la.pl_from AS value" |
47 | | - ." FROM {$pagelinks} AS lb, {$page} AS pa, {$pagelinks} AS la" |
48 | | - ." WHERE lb.pl_namespace = $dns AND lb.pl_title = $dtitle" # disambiguation template |
49 | | - ." AND pa.page_id = lb.pl_from" |
50 | | - ." AND pa.page_namespace = la.pl_namespace" |
51 | | - ." AND pa.page_title = la.pl_title"; |
| 53 | + ." FROM {$templatelinks} AS lb, {$page} AS pa, {$pagelinks} AS la" |
| 54 | + ." WHERE lb.tl_namespace = $dns AND lb.tl_title = $dtitle" # disambiguation template |
| 55 | + .' AND pa.page_id = lb.tl_from' |
| 56 | + .' AND pa.page_namespace = la.pl_namespace' |
| 57 | + .' AND pa.page_title = la.pl_title'; |
52 | 58 | return $sql; |
53 | 59 | } |
54 | 60 | |