r12479 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12478‎ | r12479 | r12480 >
Date:14:25, 7 January 2006
Author:hashar
Status:old
Tags:
Comment:
Use the new templatelinks table. The special page assume that the template
to mark disambiguation page is in the template namespace.
Modified paths:
  • /trunk/phase3/includes/SpecialDisambiguations.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialDisambiguations.php
@@ -29,25 +29,31 @@
3030 $sk = $wgUser->getSkin();
3131
3232 #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";
3434 }
3535
3636 function getSQL() {
3737 $dbr =& wfGetDB( DB_SLAVE );
38 - extract( $dbr->tableNames( 'page', 'pagelinks' ) );
 38+ extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) );
3939
40 - $dp = Title::newFromText(wfMsgForContent("disambiguationspage"));
 40+ $dp = Title::newFromText(wfMsgForContent('disambiguationspage'));
4141 $id = $dp->getArticleId();
4242 $dns = $dp->getNamespace();
4343 $dtitle = $dbr->addQuotes( $dp->getDBkey() );
4444
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,"
4652 ." 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';
5258 return $sql;
5359 }
5460

Status & tagging log