* (bug 385) Installer support for PostgreSQL, fixes for PG compatibility
[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 /**
26 * This query is indexed as of 1.5
27 */
28 function isExpensive() {
29 return true;
30 }
31
32 function isSyndicated() {
33 return false;
34 }
35
36 function getSQL() {
37 $dbr =& wfGetDB( DB_SLAVE );
38 $page = $dbr->tableName( 'page' );
39 $name = $dbr->addQuotes( $this->getName() );
40
41 $forceindex = $dbr->useIndexClause("page_len");
42 return
43 "SELECT $name as type,
44 page_namespace as namespace,
45 page_title as title,
46 page_len AS value
47 FROM $page $forceindex
48 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
49 }
50
51 function sortDescending() {
52 return false;
53 }
54
55 function formatResult( $skin, $result ) {
56 global $wgLang, $wgContLang;
57 $nb = htmlspecialchars( wfMsg( 'nbytes', $wgLang->formatNum( $result->value ) ) );
58 $title = Title::makeTitle( $result->namespace, $result->title );
59 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
60 $histlink = $skin->makeKnownLinkObj( $title, wfMsgHtml('hist'), 'action=history' );
61 return "({$histlink}) $link ({$nb})";
62 }
63 }
64
65 /**
66 * constructor
67 */
68 function wfSpecialShortpages() {
69 list( $limit, $offset ) = wfCheckLimits();
70
71 $spp = new ShortPagesPage();
72
73 return $spp->doQuery( $offset, $limit );
74 }
75
76 ?>