* (bug 829) Fix URL-escaping on block success
[mediawiki.git] / includes / SpecialShortpages.php
blobf99642831d9b34584e46e9de03dcc67bc3ed6d6f
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;
28 function isSyndicated() { return false; }
30 function getSQL() {
31 $dbr =& wfGetDB( DB_SLAVE );
32 $page = $dbr->tableName( 'page' );
33 $text = $dbr->tableName( 'text' );
34 $name = $dbr->addQuotes( $this->getName() );
36 # FIXME: Not only is this teh suck, it will fail
37 # if we compress revisions on save as it will return
38 # the compressed size.
39 return
40 "SELECT $name as type,
41 page_namespace as namespace,
42 page_title as title,
43 LENGTH(old_text) AS value
44 FROM $page, $text
45 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
46 AND page_latest=old_id";
49 function sortDescending() {
50 return false;
53 function formatResult( $skin, $result ) {
54 global $wgLang, $wgContLang;
55 $nb = wfMsg( "nbytes", $wgLang->formatNum( $result->value ) );
56 $link = $skin->makeKnownLink( $result->title, $wgContLang->convert( $result->title ) );
57 return "{$link} ({$nb})";
61 /**
62 * constructor
64 function wfSpecialShortpages() {
65 list( $limit, $offset ) = wfCheckLimits();
67 $spp = new ShortPagesPage();
69 return $spp->doQuery( $offset, $limit );