Sample files for noobs like me.
[mediawiki.git] / includes / SpecialWantedpages.php
blob2f16efb5a95d41a60985e40c44fd004134f877d1
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 WantedPagesPage extends QueryPage {
20 function getName() {
21 return 'Wantedpages';
24 function isExpensive() {
25 return true;
27 function isSyndicated() { return false; }
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";
46 function formatResult( $skin, $result ) {
47 global $wgContLang;
49 $nt = Title::makeTitle( $result->namespace, $result->title );
50 $text = $wgContLang->convert( $nt->getPrefixedText() );
51 $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
53 $nl = wfMsg( "nlinks", $result->value );
54 $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl,
55 "target=" . $nt->getPrefixedURL() );
57 return "{$plink} ({$nlink})";
61 /**
62 * constructor
64 function wfSpecialWantedpages() {
65 list( $limit, $offset ) = wfCheckLimits();
67 $wpp = new WantedPagesPage();
69 $wpp->doQuery( $offset, $limit );