* Fix notice on search index update due to non-array
[lhc/web/wiklou.git] / includes / SpecialWantedpages.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 WantedPagesPage extends QueryPage {
19
20 function getName() {
21 return 'Wantedpages';
22 }
23
24 function isExpensive() {
25 return true;
26 }
27 function isSyndicated() { return false; }
28
29 function getSQL() {
30 $dbr =& wfGetDB( DB_SLAVE );
31 $pagelinks = $dbr->tableName( 'pagelinks' );
32 $page = $dbr->tableName( 'page' );
33 return
34 "SELECT 'Wantedpages' AS type,
35 pl_namespace AS namespace,
36 pl_title AS title,
37 COUNT(*) AS value
38 FROM $pagelinks
39 LEFT JOIN $page
40 ON pl_namespace=page_namespace AND pl_title=page_title
41 WHERE page_namespace IS NULL
42 GROUP BY pl_namespace,pl_title
43 HAVING COUNT(*) > 1";
44 }
45
46 function formatResult( $skin, $result ) {
47 global $wgContLang;
48
49 $nt = Title::makeTitle( $result->namespace, $result->title );
50 $text = $wgContLang->convert( $nt->getPrefixedText() );
51 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
52
53 $nl = wfMsg( "nlinks", $result->value );
54 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl,
55 "target=" . $nt->getPrefixedURL() );
56
57 return "{$plink} ({$nlink})";
58 }
59 }
60
61 /**
62 * constructor
63 */
64 function wfSpecialWantedpages() {
65 list( $limit, $offset ) = wfCheckLimits();
66
67 $wpp = new WantedPagesPage();
68
69 $wpp->doQuery( $offset, $limit );
70 }
71
72 ?>