5 * @subpackage SpecialPage
9 * SpecialShortpages extends QueryPage. It is used to return the shortest
10 * pages in the database.
12 * @subpackage SpecialPage
14 class ShortPagesPage
extends QueryPage
{
21 * This query is indexed as of 1.5
23 function isExpensive() {
27 function isSyndicated() {
32 $dbr =& wfGetDB( DB_SLAVE
);
33 $page = $dbr->tableName( 'page' );
34 $name = $dbr->addQuotes( $this->getName() );
36 $forceindex = $dbr->useIndexClause("page_len");
38 "SELECT $name as type,
39 page_namespace as namespace,
42 FROM $page $forceindex
43 WHERE page_namespace=".NS_MAIN
." AND page_is_redirect=0";
46 function sortDescending() {
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();
58 return "({$histlink}) {$dirmark}$link {$dirmark}({$nb})";
65 function wfSpecialShortpages() {
66 list( $limit, $offset ) = wfCheckLimits();
68 $spp = new ShortPagesPage();
70 return $spp->doQuery( $offset, $limit );