5 * @subpackage SpecialPage
11 require_once('QueryPage.php');
16 * @subpackage SpecialPage
18 class DisambiguationsPage
extends PageQueryPage
{
21 return 'Disambiguations';
24 function isExpensive( ) { return true; }
25 function isSyndicated() { return false; }
27 function getPageHeader( ) {
29 $sk = $wgUser->getSkin();
31 #FIXME : probably need to add a backlink to the maintenance page.
32 return '<p>'.wfMsg("disambiguationstext", $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
36 $dbr =& wfGetDB( DB_SLAVE
);
37 extract( $dbr->tableNames( 'page', 'pagelinks' ) );
39 $dp = Title
::newFromText(wfMsgForContent("disambiguationspage"));
40 $id = $dp->getArticleId();
41 $dns = $dp->getNamespace();
42 $dtitle = $dbr->addQuotes( $dp->getDBkey() );
44 $sql = "SELECT 'Disambiguations' as type,"
45 . "la.pl_namespace AS namespace, la.pl_title AS title, la.pl_from AS value"
46 . " FROM {$pagelinks} AS la, {$pagelinks} AS lb,"
47 . " {$page} AS pa, {$page} AS pb"
48 . " WHERE pb.page_namespace = $dns"
49 . " AND pb.page_title = $dtitle" # disambiguation pages
50 . " AND lb.pl_title = pb.page_title" # title of pages that are disamb
51 . " AND pa.page_id = lb.pl_from" # id of page poiting to a disamb
52 . " AND la.pl_title = pa.page_title"; # title of those
60 function formatResult( $skin, $result ) {
62 $title = Title
::newFromId( $result->value
);
63 $dp = Title
::makeTitle( $result->namespace, $result->title
);
65 $from = $skin->makeKnownLinkObj( $title,'');
66 $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
67 $to = $skin->makeKnownLinkObj( $dp,'');
69 return "$from $edit => $to";
76 function wfSpecialDisambiguations() {
77 list( $limit, $offset ) = wfCheckLimits();
79 $sd = new DisambiguationsPage();
81 return $sd->doQuery( $offset, $limit );