* Fixed a bug where Special:Contributions wouldn't remember the 'invert'
[mediawiki.git] / includes / SpecialDisambiguations.php
blob10a329490b626f36f8bc546850d5971f2dfaa544
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
11 require_once('QueryPage.php');
13 /**
15 * @package MediaWiki
16 * @subpackage SpecialPage
18 class DisambiguationsPage extends PageQueryPage {
20 function getName() {
21 return 'disambiguations';
24 function isExpensive( ) { return true; }
25 function isSyndicated() { return false; }
27 function getPageHeader( ) {
28 global $wgUser;
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";
35 function getSQL() {
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 . " pl_namespace AS namespace, pl_title AS title"
46 . " FROM {$pagelinks}, {$page}"
47 . " WHERE page_namespace = $dns"
48 . " AND page_title = $dtitle"
49 . " AND pl_from=page_id";
51 return $sql;
54 function getOrder() {
55 return '';
58 function formatResult( $skin, $result ) {
59 global $wgContLang ;
60 $dp = Title::newFromText(wfMsgForContent("disambiguationspage"));
61 $title = 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";
71 /**
72 * Constructor
74 function wfSpecialDisambiguations() {
75 list( $limit, $offset ) = wfCheckLimits();
77 $sd = new DisambiguationsPage();
79 return $sd->doQuery( $offset, $limit );