wiki.techinc.nl/includes/SpecialWantedpages.php
Brion Vibber e0ce5a322e * links and brokenlinks tables merged to pagelinks; this will reduce pain
dealing with moves and deletes of widely-linked pages.

The updaters should be fixed up to understand future versions without the
tables there without breaking upgrades.
2005-05-26 10:23:36 +00:00

72 lines
1.4 KiB
PHP

<?php
/**
*
* @package MediaWiki
* @subpackage SpecialPage
*/
/**
*
*/
require_once ( 'QueryPage.php' ) ;
/**
*
* @package MediaWiki
* @subpackage SpecialPage
*/
class WantedPagesPage extends QueryPage {
function getName() {
return 'Wantedpages';
}
function isExpensive() {
return true;
}
function isSyndicated() { return false; }
function getSQL() {
$dbr =& wfGetDB( DB_SLAVE );
$pagelinks = $dbr->tableName( 'pagelinks' );
$page = $dbr->tableName( 'page' );
return
"SELECT 'Wantedpages' AS type,
pl_namespace AS namespace,
pl_title AS title,
COUNT(*) AS value
FROM $pagelinks
LEFT JOIN $page
ON pl_namespace=page_namespace AND pl_title=page_title
WHERE page_namespace IS NULL
GROUP BY pl_namespace,pl_title
HAVING COUNT(*) > 1";
}
function formatResult( $skin, $result ) {
global $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
$plink = $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
$nl = wfMsg( "nlinks", $result->value );
$nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl,
"target=" . $nt->getPrefixedURL() );
return "{$plink} ({$nlink})";
}
}
/**
* constructor
*/
function wfSpecialWantedpages() {
list( $limit, $offset ) = wfCheckLimits();
$wpp = new WantedPagesPage();
$wpp->doQuery( $offset, $limit );
}
?>