00001 <?php
00013 class FewestrevisionsPage extends QueryPage {
00014
00015 function getName() {
00016 return 'Fewestrevisions';
00017 }
00018
00019 function isExpensive() {
00020 return true;
00021 }
00022
00023 function isSyndicated() {
00024 return false;
00025 }
00026
00027 function getSql() {
00028 $dbr = wfGetDB( DB_SLAVE );
00029 list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
00030
00031 return "SELECT 'Fewestrevisions' as type,
00032 page_namespace as namespace,
00033 page_title as title,
00034 page_is_redirect as redirect,
00035 COUNT(*) as value
00036 FROM $revision
00037 JOIN $page ON page_id = rev_page
00038 WHERE page_namespace = " . NS_MAIN . "
00039 GROUP BY page_namespace, page_title, page_is_redirect
00040 HAVING COUNT(*) > 1";
00041
00042
00043
00044
00045
00046 }
00047
00048 function sortDescending() {
00049 return false;
00050 }
00051
00052 function formatResult( $skin, $result ) {
00053 global $wgLang, $wgContLang;
00054
00055 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
00056 if( !$nt ) {
00057 return '<!-- bad title -->';
00058 }
00059
00060 $text = $wgContLang->convert( $nt->getPrefixedText() );
00061
00062 $plink = $skin->linkKnown(
00063 $nt,
00064 $text
00065 );
00066
00067 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape' ),
00068 $wgLang->formatNum( $result->value ) );
00069 $redirect = $result->redirect ? ' - ' . wfMsgHtml( 'isredirect' ) : '';
00070 $nlink = $skin->linkKnown(
00071 $nt,
00072 $nl,
00073 array(),
00074 array( 'action' => 'history' )
00075 ) . $redirect;
00076
00077 return wfSpecialList( $plink, $nlink );
00078 }
00079 }
00080
00081 function wfSpecialFewestrevisions() {
00082 list( $limit, $offset ) = wfCheckLimits();
00083 $frp = new FewestrevisionsPage();
00084 $frp->doQuery( $offset, $limit );
00085 }