10 class DisambiguationsPage
extends PageQueryPage
{
13 return 'Disambiguations';
16 function isExpensive( ) { return true; }
17 function isSyndicated() { return false; }
20 function getPageHeader( ) {
21 return wfMsgExt( 'disambiguations-text', array( 'parse' ) );
25 $dbr = wfGetDB( DB_SLAVE
);
27 $linkBatch = new LinkBatch
;
28 foreach( wfGetDisambiguationTemplates() as $tl )
29 $linkBatch->addObj( $tl );
31 $set = $linkBatch->constructSet( 'lb.tl', $dbr );
32 if( $set === false ) {
33 # We must always return a valid sql query, but this way DB will always quicly return an empty result
35 wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n");
38 list( $page, $pagelinks, $templatelinks) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' );
40 $sql = "SELECT 'Disambiguations' AS \"type\", pb.page_namespace AS namespace,"
41 ." pb.page_title AS title, la.pl_from AS value"
42 ." FROM {$templatelinks} AS lb, {$page} AS pb, {$pagelinks} AS la, {$page} AS pa"
43 ." WHERE $set" # disambiguation template(s)
44 .' AND pa.page_id = la.pl_from'
45 .' AND pa.page_namespace = ' . NS_MAIN
# Limit to just articles in the main namespace
46 .' AND pb.page_id = lb.tl_from'
47 .' AND pb.page_namespace = la.pl_namespace'
48 .' AND pb.page_title = la.pl_title'
49 .' ORDER BY lb.tl_namespace, lb.tl_title';
58 function formatResult( $skin, $result ) {
60 $title = Title
::newFromID( $result->value
);
61 $dp = Title
::makeTitle( $result->namespace, $result->title
);
63 $from = $skin->link( $title );
64 $edit = $skin->link( $title, "(".wfMsgHtml("qbedit").")", array(), array( 'redirect' => 'no', 'action' => 'edit' ) );
65 $arr = $wgContLang->getArrow();
66 $to = $skin->link( $dp );
68 return "$from $edit $arr $to";
75 function wfSpecialDisambiguations() {
76 list( $limit, $offset ) = wfCheckLimits();
78 $sd = new DisambiguationsPage();
80 return $sd->doQuery( $offset, $limit );