5 * @subpackage SpecialPage
11 require_once("QueryPage.php");
14 * SpecialShortpages extends QueryPage. It is used to return the shortest
15 * pages in the database.
17 * @subpackage SpecialPage
19 class ShortPagesPage
extends QueryPage
{
26 * This query is indexed as of 1.5
28 function isExpensive() {
32 function isSyndicated() {
37 $dbr =& wfGetDB( DB_SLAVE
);
38 $page = $dbr->tableName( 'page' );
39 $name = $dbr->addQuotes( $this->getName() );
41 $forceindex = $dbr->useIndexClause("page_len");
43 "SELECT $name as type,
44 page_namespace as namespace,
47 FROM $page $forceindex
48 WHERE page_namespace=".NS_MAIN
." AND page_is_redirect=0";
51 function sortDescending() {
55 function formatResult( $skin, $result ) {
56 global $wgLang, $wgContLang;
57 $nb = wfMsgExt( 'nbytes', array('parsemag', 'escape'), $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 $dirmark = $wgContLang->getDirMark();
63 return "({$histlink}) {$dirmark}$link {$dirmark}({$nb})";
70 function wfSpecialShortpages() {
71 list( $limit, $offset ) = wfCheckLimits();
73 $spp = new ShortPagesPage();
75 return $spp->doQuery( $offset, $limit );