* (bug 1949) Profiling typo in rare error case
[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 function isSyndicated() { return false; }
26
27 function getPageHeader( ) {
28 global $wgUser;
29 $sk = $wgUser->getSkin();
30
31 #FIXME : probably need to add a backlink to the maintenance page.
32 return '<p>'.wfMsg("disambiguationstext", $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
33 }
34
35 function getSQL() {
36 $dbr =& wfGetDB( DB_SLAVE );
37 extract( $dbr->tableNames( 'page', 'links' ) );
38
39 $dp = Title::newFromText(wfMsgForContent("disambiguationspage"));
40 $dpid = $dp->getArticleID();
41
42 $sql = "SELECT pa.page_namespace AS ns_art, pa.page_title AS title_art,"
43 . " pb.page_namespace AS ns_dis, pb.page_title AS title_dis"
44 . " FROM {$links} as la, {$links} as lb, {$page} as pa, {$page} as pb"
45 . " WHERE la.l_to = '{$dpid}'"
46 . " AND la.l_from = lb.l_to"
47 . " AND pa.page_id = lb.l_from"
48 . " AND pb.page_id = lb.l_to";
49
50 return $sql;
51 }
52
53 function getOrder() {
54 return '';
55 }
56
57 function formatResult( $skin, $result ) {
58 global $wgContLang ;
59 $ns = $wgContLang->getNamespaces() ;
60
61 $from = $skin->makeKnownLink( $ns[$result->ns_art].':'.$result->title_art ,'');
62 $edit = $skin->makeBrokenLink( $ns[$result->ns_art].':'.$result->title_art , "(".wfMsg("qbedit").")" , 'redirect=no');
63 $to = $skin->makeKnownLink( $ns[$result->ns_dis].':'.$result->title_dis ,'');
64
65 return "$from $edit => $to";
66 }
67 }
68
69 /**
70 * Constructor
71 */
72 function wfSpecialDisambiguations() {
73 list( $limit, $offset ) = wfCheckLimits();
74
75 $sd = new DisambiguationsPage();
76
77 return $sd->doQuery( $offset, $limit );
78
79 }
80 ?>