removed a debug output when setting up the dropbox for language variants
[lhc/web/wiklou.git] / includes / SpecialDisambiguations.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 require_once('QueryPage.php');
12
13 /**
14 *
15 * @package MediaWiki
16 * @subpackage SpecialPage
17 */
18 class DisambiguationsPage extends PageQueryPage {
19
20 function getName() {
21 return 'disambiguations';
22 }
23
24 function isExpensive( ) { return true; }
25
26 function getPageHeader( ) {
27 global $wgUser;
28 $sk = $wgUser->getSkin();
29
30 #FIXME : probably need to add a backlink to the maintenance page.
31 return '<p>'.wfMsg("disambiguationstext", $sk->makeKnownLink(wfMsg('disambiguationspage')) )."</p><br>\n";
32 }
33
34 function getSQL() {
35 $dbr =& wfGetDB( DB_SLAVE );
36 extract( $dbr->tableNames( 'cur', 'links' ) );
37
38 $dp = Title::newFromText(wfMsg("disambiguationspage"));
39 $dpid = $dp->getArticleID();
40
41 $sql = "SELECT ca.cur_namespace AS ns_art, ca.cur_title AS title_art,"
42 . " cb.cur_namespace AS ns_dis, cb.cur_title AS title_dis"
43 . " FROM links as la, links as lb, cur as ca, cur as cb"
44 . " WHERE la.l_to = '{$dpid}'"
45 . " AND la.l_from = lb.l_to"
46 . " AND ca.cur_id = lb.l_from"
47 . " AND cb.cur_id = lb.l_to";
48
49 return $sql;
50 }
51
52 function getOrder() {
53 return '';
54 }
55
56 function formatResult( $skin, $result ) {
57 global $wgLang ;
58 $ns = $wgLang->getNamespaces() ;
59
60 $from = $skin->makeKnownLink( $ns[$result->ns_art].':'.$result->title_art ,'');
61 $edit = $skin->makeBrokenLink( $ns[$result->ns_art].':'.$result->title_art , "(".wfMsg("qbedit").")" , 'redirect=no');
62 $to = $skin->makeKnownLink( $ns[$result->ns_dis].':'.$result->title_dis ,'');
63
64 return "$from $edit => $to";
65 }
66 }
67
68 /**
69 * Constructor
70 */
71 function wfSpecialDisambiguations() {
72 list( $limit, $offset ) = wfCheckLimits();
73
74 $sd = new DisambiguationsPage();
75
76 return $sd->doQuery( $offset, $limit );
77
78 }
79 ?>