5 * @subpackage SpecialPage
11 * @subpackage SpecialPage
13 class DisambiguationsPage
extends PageQueryPage
{
16 return 'Disambiguations';
19 function isExpensive( ) { return true; }
20 function isSyndicated() { return false; }
22 function getPageHeader( ) {
24 $sk = $wgUser->getSkin();
26 #FIXME : probably need to add a backlink to the maintenance page.
27 return '<p>'.wfMsg('disambiguationstext', $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
31 $dbr =& wfGetDB( DB_SLAVE
);
32 extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) );
34 $dp = Title
::newFromText(wfMsgForContent('disambiguationspage'));
35 $id = $dp->getArticleId();
36 $dns = $dp->getNamespace();
37 $dtitle = $dbr->addQuotes( $dp->getDBkey() );
39 if($dns != NS_TEMPLATE
) {
40 # FIXME we assume the disambiguation message is a template but
41 # the page can potentially be from another namespace :/
42 wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
45 $sql = "SELECT 'Disambiguations' AS \"type\", pa.page_namespace AS namespace,"
46 ." pa.page_title AS title, la.pl_from AS value"
47 ." FROM {$templatelinks} AS lb, {$page} AS pa, {$pagelinks} AS la"
48 ." WHERE lb.tl_namespace = $dns AND lb.tl_title = $dtitle" # disambiguation template
49 .' AND pa.page_id = lb.tl_from'
50 .' AND pa.page_namespace = la.pl_namespace'
51 .' AND pa.page_title = la.pl_title';
59 function formatResult( $skin, $result ) {
60 $title = Title
::newFromId( $result->value
);
61 $dp = Title
::makeTitle( $result->namespace, $result->title
);
63 $from = $skin->makeKnownLinkObj( $title,'');
64 $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
65 $to = $skin->makeKnownLinkObj( $dp,'');
67 return "$from $edit => $to";
74 function wfSpecialDisambiguations() {
75 list( $limit, $offset ) = wfCheckLimits();
77 $sd = new DisambiguationsPage();
79 return $sd->doQuery( $offset, $limit );