Bug 6031 (feature request for __NOGALLERY__ on category pages) fixed
[lhc/web/wiklou.git] / includes / SpecialShortpages.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 * SpecialShortpages extends QueryPage. It is used to return the shortest
10 * pages in the database.
11 * @package MediaWiki
12 * @subpackage SpecialPage
13 */
14 class ShortPagesPage extends QueryPage {
15
16 function getName() {
17 return "Shortpages";
18 }
19
20 /**
21 * This query is indexed as of 1.5
22 */
23 function isExpensive() {
24 return true;
25 }
26
27 function isSyndicated() {
28 return false;
29 }
30
31 function getSQL() {
32 $dbr =& wfGetDB( DB_SLAVE );
33 $page = $dbr->tableName( 'page' );
34 $name = $dbr->addQuotes( $this->getName() );
35
36 $forceindex = $dbr->useIndexClause("page_len");
37 return
38 "SELECT $name as type,
39 page_namespace as namespace,
40 page_title as title,
41 page_len AS value
42 FROM $page $forceindex
43 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
44 }
45
46 function sortDescending() {
47 return false;
48 }
49
50 function formatResult( $skin, $result ) {
51 global $wgLang, $wgContLang;
52 $nb = wfMsgExt( 'nbytes', array('parsemag', 'escape'), $wgLang->formatNum( $result->value ) );
53 $title = Title::makeTitle( $result->namespace, $result->title );
54 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
55 $histlink = $skin->makeKnownLinkObj( $title, wfMsgHtml('hist'), 'action=history' );
56 $dirmark = $wgContLang->getDirMark();
57
58 return "({$histlink}) {$dirmark}$link {$dirmark}({$nb})";
59 }
60 }
61
62 /**
63 * constructor
64 */
65 function wfSpecialShortpages() {
66 list( $limit, $offset ) = wfCheckLimits();
67
68 $spp = new ShortPagesPage();
69
70 return $spp->doQuery( $offset, $limit );
71 }
72
73 ?>