Fix http://bugzilla.wikipedia.org/show_bug.cgi?id=459 Sorting tabindex.
[mediawiki.git] / includes / SpecialShortpages.php
blob3aeaa4f5d65541922de7a3aae4882ba3c14e1b7a
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
11 require_once("QueryPage.php");
13 /**
14 * SpecialShortpages extends QueryPage. It is used to return the shortest
15 * pages in the database.
16 * @package MediaWiki
17 * @subpackage SpecialPage
19 class ShortPagesPage extends QueryPage {
21 function getName() {
22 return "Shortpages";
25 function isExpensive() {
26 return true;
29 function getSQL() {
30 $dbr =& wfGetDB( DB_SLAVE );
31 $cur = $dbr->tableName( 'cur' );
33 return
34 "SELECT 'Shortpages' as type,
35 cur_namespace as namespace,
36 cur_title as title,
37 LENGTH(cur_text) AS value
38 FROM $cur
39 WHERE cur_namespace=0 AND cur_is_redirect=0";
42 function sortDescending() {
43 return false;
46 function formatResult( $skin, $result ) {
47 global $wgLang;
48 $nb = wfMsg( "nbytes", $wgLang->formatNum( $result->value ) );
49 $link = $skin->makeKnownLink( $result->title, "" );
50 return "{$link} ({$nb})";
54 /**
55 * constructor
57 function wfSpecialShortpages() {
58 list( $limit, $offset ) = wfCheckLimits();
60 $spp = new ShortPagesPage();
62 return $spp->doQuery( $offset, $limit );