wiki.techinc.nl/includes/SpecialShortpages.php
Tim Starling ac549401d4 * Support for table name prefixes throughout the code. No support yet for converting static SQL, which also means no installation. But it has been tested by creating the tables in the ordinary way and then renaming them
* DB_WRITE now called DB_MASTER, DB_READ now called DB_SLAVE
* Converted to use SQL wrapper functions instead of direct SQL in various places
* Experimental method for preserving the chronological order of events when slave servers are used. Untested.
* Fixes to the new post-parse existence test feature
* Some.. other stuff
2004-07-18 08:48:43 +00:00

52 lines
997 B
PHP

<?php
#
# SpecialShortpages extends QueryPage. It is used to return the shortest
# pages in the database.
#
require_once("QueryPage.php");
class ShortPagesPage extends QueryPage {
function getName() {
return "Shortpages";
}
function isExpensive() {
return true;
}
function getSQL() {
$dbr =& wfGetDB( DB_SLAVE );
$cur = $dbr->tableName( 'cur' );
return
"SELECT 'Shortpages' as type,
cur_namespace as namespace,
cur_title as title,
LENGTH(cur_text) AS value
FROM $cur
WHERE cur_namespace=0 AND cur_is_redirect=0";
}
function sortDescending() {
return false;
}
function formatResult( $skin, $result ) {
global $wgLang;
$nb = wfMsg( "nbytes", $wgLang->formatNum( $result->value ) );
$link = $skin->makeKnownLink( $result->title, "" );
return "{$link} ({$nb})";
}
}
function wfSpecialShortpages() {
list( $limit, $offset ) = wfCheckLimits();
$spp = new ShortPagesPage();
return $spp->doQuery( $offset, $limit );
}
?>