wiki.techinc.nl/includes/SpecialShortpages.php

53 lines
997 B
PHP
Raw Normal View History

<?php
2004-06-12 19:47:53 +00:00
#
# SpecialShortpages extends QueryPage. It is used to return the shortest
# pages in the database.
#
2003-04-14 23:10:40 +00:00
2004-05-07 13:43:10 +00:00
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})";
}
}
2004-06-12 19:47:53 +00:00
function wfSpecialShortpages() {
list( $limit, $offset ) = wfCheckLimits();
$spp = new ShortPagesPage();
return $spp->doQuery( $offset, $limit );
2003-04-14 23:10:40 +00:00
}
?>