* some comments (using # instead of /* */ )
[lhc/web/wiklou.git] / includes / SpecialShortpages.php
1 <?php
2 #
3 # SpecialShortpages extends QueryPage. It is used to return the shortest
4 # pages in the database.
5 #
6
7 require_once("QueryPage.php");
8
9 class ShortPagesPage extends QueryPage {
10
11 function getName() {
12 return "Shortpages";
13 }
14
15 function isExpensive() {
16 return true;
17 }
18
19 function getSQL() {
20 $dbr =& wfGetDB( DB_SLAVE );
21 $cur = $dbr->tableName( 'cur' );
22
23 return
24 "SELECT 'Shortpages' as type,
25 cur_namespace as namespace,
26 cur_title as title,
27 LENGTH(cur_text) AS value
28 FROM $cur
29 WHERE cur_namespace=0 AND cur_is_redirect=0";
30 }
31
32 function sortDescending() {
33 return false;
34 }
35
36 function formatResult( $skin, $result ) {
37 global $wgLang;
38 $nb = wfMsg( "nbytes", $wgLang->formatNum( $result->value ) );
39 $link = $skin->makeKnownLink( $result->title, "" );
40 return "{$link} ({$nb})";
41 }
42 }
43
44 function wfSpecialShortpages() {
45 list( $limit, $offset ) = wfCheckLimits();
46
47 $spp = new ShortPagesPage();
48
49 return $spp->doQuery( $offset, $limit );
50 }
51
52 ?>