working attributes and common HTML
[lhc/web/wiklou.git] / includes / SpecialShortpages.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 require_once("QueryPage.php");
12
13 /**
14 * SpecialShortpages extends QueryPage. It is used to return the shortest
15 * pages in the database.
16 * @package MediaWiki
17 * @subpackage SpecialPage
18 */
19 class ShortPagesPage extends QueryPage {
20
21 function getName() {
22 return "Shortpages";
23 }
24
25 function isExpensive() {
26 return true;
27 }
28 function isSyndicated() { return false; }
29
30 function getSQL() {
31 $dbr =& wfGetDB( DB_SLAVE );
32 $page = $dbr->tableName( 'page' );
33 $text = $dbr->tableName( 'text' );
34 $name = $dbr->addQuotes( $this->getName() );
35
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=0 AND page_is_redirect=0
46 AND page_latest=old_id";
47 }
48
49 function sortDescending() {
50 return false;
51 }
52
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})";
58 }
59 }
60
61 /**
62 * constructor
63 */
64 function wfSpecialShortpages() {
65 list( $limit, $offset ) = wfCheckLimits();
66
67 $spp = new ShortPagesPage();
68
69 return $spp->doQuery( $offset, $limit );
70 }
71
72 ?>