00001 <?php 00002 # 00003 # SpecialShortpages extends QueryPage. It is used to return the shortest 00004 # pages in the database. 00005 # 00006 00007 require_once("QueryPage.php"); 00008 00009 class ShortPagesPage extends QueryPage { 00010 00011 function getName() { 00012 return "Shortpages"; 00013 } 00014 00015 function isExpensive() { 00016 return true; 00017 } 00018 00019 function getSQL() { 00020 return 00021 "SELECT 'Shortpages' as type, 00022 cur_namespace as namespace, 00023 cur_title as title, 00024 LENGTH(cur_text) AS value 00025 FROM cur 00026 WHERE cur_namespace=0 AND cur_is_redirect=0"; 00027 } 00028 00029 function sortDescending() { 00030 return false; 00031 } 00032 00033 function formatResult( $skin, $result ) { 00034 global $wgLang; 00035 $nb = wfMsg( "nbytes", $wgLang->formatNum( $result->value ) ); 00036 $link = $skin->makeKnownLink( $result->title, "" ); 00037 return "{$link} ({$nb})"; 00038 } 00039 } 00040 00041 function wfSpecialShortpages() { 00042 list( $limit, $offset ) = wfCheckLimits(); 00043 00044 $spp = new ShortPagesPage(); 00045 00046 return $spp->doQuery( $offset, $limit ); 00047 } 00048 00049 ?>