remove unused message
[lhc/web/wiklou.git] / includes / SpecialDisambiguations.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 * @package MediaWiki
11 * @subpackage SpecialPage
12 */
13 class DisambiguationsPage extends PageQueryPage {
14
15 function getName() {
16 return 'Disambiguations';
17 }
18
19 function isExpensive( ) { return true; }
20 function isSyndicated() { return false; }
21
22 function getPageHeader( ) {
23 global $wgUser;
24 $sk = $wgUser->getSkin();
25
26 #FIXME : probably need to add a backlink to the maintenance page.
27 return '<p>'.wfMsg('disambiguationstext', $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
28 }
29
30 function getSQL() {
31 $dbr =& wfGetDB( DB_SLAVE );
32 extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) );
33
34 $dp = Title::newFromText(wfMsgForContent('disambiguationspage'));
35 $id = $dp->getArticleId();
36 $dns = $dp->getNamespace();
37 $dtitle = $dbr->addQuotes( $dp->getDBkey() );
38
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");
43 }
44
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';
52 return $sql;
53 }
54
55 function getOrder() {
56 return '';
57 }
58
59 function formatResult( $skin, $result ) {
60 $title = Title::newFromId( $result->value );
61 $dp = Title::makeTitle( $result->namespace, $result->title );
62
63 $from = $skin->makeKnownLinkObj( $title,'');
64 $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
65 $to = $skin->makeKnownLinkObj( $dp,'');
66
67 return "$from $edit => $to";
68 }
69 }
70
71 /**
72 * Constructor
73 */
74 function wfSpecialDisambiguations() {
75 list( $limit, $offset ) = wfCheckLimits();
76
77 $sd = new DisambiguationsPage();
78
79 return $sd->doQuery( $offset, $limit );
80 }
81 ?>