revert to Wiki.php 1.28 and index.php 1.130
[mediawiki.git] / includes / SpecialShortpages.php
blobe878a2aacc441ddfefe63ad0864e83effcc175a2
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 /**
26 * This query is indexed as of 1.5
28 function isExpensive() {
29 return true;
32 function isSyndicated() {
33 return false;
36 function getSQL() {
37 $dbr =& wfGetDB( DB_SLAVE );
38 $page = $dbr->tableName( 'page' );
39 $name = $dbr->addQuotes( $this->getName() );
41 return
42 "SELECT $name as type,
43 page_namespace as namespace,
44 page_title as title,
45 page_len AS value
46 FROM $page FORCE INDEX (page_len)
47 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
50 function sortDescending() {
51 return false;
54 function formatResult( $skin, $result ) {
55 global $wgLang, $wgContLang;
56 $nb = htmlspecialchars( wfMsg( "nbytes", $wgLang->formatNum( $result->value ) ) );
57 $title = Title::makeTitle( $result->namespace, $result->title );
58 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
59 return "{$link} ({$nb})";
63 /**
64 * constructor
66 function wfSpecialShortpages() {
67 list( $limit, $offset ) = wfCheckLimits();
69 $spp = new ShortPagesPage();
71 return $spp->doQuery( $offset, $limit );