category redirect bug fix
[mediawiki.git] / includes / SpecialShortpages.php
blob4feb514e274fbf2b086778d93dba9160c0315682
1 <?php
3 # SpecialShortpages extends QueryPage. It is used to return the shortest
4 # pages in the database.
7 require_once("QueryPage.php");
9 class ShortPagesPage extends QueryPage {
11 function getName() {
12 return "Shortpages";
15 function isExpensive() {
16 return true;
19 function getSQL() {
20 $dbr =& wfGetDB( DB_SLAVE );
21 $cur = $dbr->tableName( 'cur' );
23 return
24 "SELECT 'Shortpages' as type,
25 cur_namespace as namespace,
26 cur_title as title,
27 LENGTH(cur_text) AS value
28 FROM $cur
29 WHERE cur_namespace=0 AND cur_is_redirect=0";
32 function sortDescending() {
33 return false;
36 function formatResult( $skin, $result ) {
37 global $wgLang;
38 $nb = wfMsg( "nbytes", $wgLang->formatNum( $result->value ) );
39 $link = $skin->makeKnownLink( $result->title, "" );
40 return "{$link} ({$nb})";
44 function wfSpecialShortpages() {
45 list( $limit, $offset ) = wfCheckLimits();
47 $spp = new ShortPagesPage();
49 return $spp->doQuery( $offset, $limit );