MediaWiki
REL1_20
|
00001 <?php 00030 class FewestrevisionsPage extends QueryPage { 00031 00032 function __construct( $name = 'Fewestrevisions' ) { 00033 parent::__construct( $name ); 00034 } 00035 00036 function isExpensive() { 00037 return true; 00038 } 00039 00040 function isSyndicated() { 00041 return false; 00042 } 00043 00044 function getQueryInfo() { 00045 return array ( 00046 'tables' => array ( 'revision', 'page' ), 00047 'fields' => array ( 'namespace' => 'page_namespace', 00048 'title' => 'page_title', 00049 'value' => 'COUNT(*)', 00050 'redirect' => 'page_is_redirect' ), 00051 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces(), 00052 'page_id = rev_page' ), 00053 'options' => array ( 'HAVING' => 'COUNT(*) > 1', 00054 // ^^^ This was probably here to weed out redirects. 00055 // Since we mark them as such now, it might be 00056 // useful to remove this. People _do_ create pages 00057 // and never revise them, they aren't necessarily 00058 // redirects. 00059 'GROUP BY' => array( 'page_namespace', 'page_title', 'page_is_redirect' ) ) 00060 ); 00061 } 00062 00063 00064 function sortDescending() { 00065 return false; 00066 } 00067 00073 function formatResult( $skin, $result ) { 00074 global $wgContLang; 00075 00076 $nt = Title::makeTitleSafe( $result->namespace, $result->title ); 00077 if( !$nt ) { 00078 return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), 00079 Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) ); 00080 } 00081 00082 $text = htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ); 00083 $plink = Linker::linkKnown( $nt, $text ); 00084 00085 $nl = $this->msg( 'nrevisions' )->numParams( $result->value )->escaped(); 00086 $redirect = isset( $result->redirect ) && $result->redirect ? 00087 ' - ' . $this->msg( 'isredirect' )->escaped() : ''; 00088 $nlink = Linker::linkKnown( 00089 $nt, 00090 $nl, 00091 array(), 00092 array( 'action' => 'history' ) 00093 ) . $redirect; 00094 00095 return $this->getLanguage()->specialList( $plink, $nlink ); 00096 } 00097 }