MediaWiki  REL1_19
SpecialFewestrevisions.php
Go to the documentation of this file.
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 ( 'page_namespace AS namespace',
00048                                         'page_title AS title',
00049                                         'COUNT(*) AS value',
00050                                         'page_is_redirect AS 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' => 'page_namespace, page_title, page_is_redirect' )
00060                 );
00061         }
00062 
00063 
00064         function sortDescending() {
00065                 return false;
00066         }
00067 
00072         function formatResult( $skin, $result ) {
00073                 global $wgContLang;
00074 
00075                 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
00076                 if( !$nt ) {
00077                         return '<!-- bad title -->';
00078                 }
00079 
00080                 $text = htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) );
00081                 $plink = Linker::linkKnown( $nt, $text );
00082 
00083                 $nl = $this->msg( 'nrevisions' )->numParams( $result->value )->escaped();
00084                 $redirect = isset( $result->redirect ) && $result->redirect ?
00085                         ' - ' . wfMsgHtml( 'isredirect' ) : '';
00086                 $nlink = Linker::linkKnown(
00087                         $nt,
00088                         $nl,
00089                         array(),
00090                         array( 'action' => 'history' )
00091                 ) . $redirect;
00092 
00093                 return $this->getLanguage()->specialList( $plink, $nlink );
00094         }
00095 }