replace TYPE= with ENGINE=, (supported since 4.0, TYPE deprecated since 4.1)
[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 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";
48 }
49
50 function sortDescending() {
51 return false;
52 }
53
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 $histlink = $skin->makeKnownLinkObj( $title, wfMsgHtml('hist'), 'action=history' );
60 return "({$histlink}) $link ({$nb})";
61 }
62 }
63
64 /**
65 * constructor
66 */
67 function wfSpecialShortpages() {
68 list( $limit, $offset ) = wfCheckLimits();
69
70 $spp = new ShortPagesPage();
71
72 return $spp->doQuery( $offset, $limit );
73 }
74
75 ?>