*/
$wgSend404Code = true;
+
+/**
+ * The $wgShowRollbackEditCount variable is used to show how many edits will be
+ * rollback. The numeric value of the varible are the limit up to are counted.
+ * If the value is false or 0, the edits are not counted.
+ */
+$wgShowRollbackEditCount = 10;
+
/** @} */ # End of output format settings }
/*************************************************************************//**
* @return String: HTML fragment
*/
public static function buildRollbackLink( $rev, IContextSource $context = null ) {
+ global $wgShowRollbackEditCount;
+
if ( $context === null ) {
$context = RequestContext::getMain();
}
$query['bot'] = '1';
$query['hidediff'] = '1'; // bug 15999
}
- return self::link(
- $title,
- $context->msg( 'rollbacklink' )->escaped(),
- array( 'title' => $context->msg( 'tooltip-rollback' )->text() ),
- $query,
- array( 'known', 'noclasses' )
- );
+
+ if( is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) {
+ $dbr = wfGetDB( DB_SLAVE );
+
+ // Up to the value of $wgShowRollbackEditCount revisions are counted
+ $res = $dbr->select( 'revision',
+ array( 'rev_id', 'rev_user_text' ),
+ array( 'rev_page' => $rev->getPage() ),
+ __METHOD__,
+ array( 'USE INDEX' => 'page_timestamp',
+ 'ORDER BY' => 'rev_timestamp DESC',
+ 'LIMIT' => $wgShowRollbackEditCount + 1 )
+ );
+
+ $editCount = 0;
+ while( $row = $dbr->fetchObject( $res ) ) {
+ if( $rev->getUserText() != $row->rev_user_text ) {
+ break;
+ }
+ $editCount++;
+ }
+
+ if( $editCount > $wgShowRollbackEditCount ) {
+ $editCount_output = $context->msg( 'rollbacklinkcount-morethan' )->numParams( $wgShowRollbackEditCount )->parse();
+ } else {
+ $editCount_output = $context->msg( 'rollbacklinkcount' )->numParams( $editCount )->parse();
+ }
+
+ return self::link(
+ $title,
+ $editCount_output,
+ array( 'title' => $context->msg( 'tooltip-rollback' )->text() ),
+ $query,
+ array( 'known', 'noclasses' )
+ );
+ } else {
+ return self::link(
+ $title,
+ $context->msg( 'rollbacklink' )->escaped(),
+ array( 'title' => $context->msg( 'tooltip-rollback' )->text() ),
+ $query,
+ array( 'known', 'noclasses' )
+ );
+ }
}
/**
'rollback' => 'Roll back edits',
'rollback_short' => 'Rollback',
'rollbacklink' => 'rollback',
+'rollbacklinkcount' => 'rollback $1 {{PLURAL:$1|edit|edits}}',
+'rollbacklinkcount-morethan' => 'rollback more than $1 {{PLURAL:$1|edit|edits}}',
'rollbackfailed' => 'Rollback failed',
'cantrollback' => 'Cannot revert edit;
last contributor is only author of this page.',
'rollback_short' => '{{Identical|Rollback}}',
'rollbacklink' => '{{Identical|Rollback}}
This message has a tooltip {{msg-mw|tooltip-rollback}}',
+'rollbacklinkcount' => '* $1: the number of edit that will be rollbacked
+If $1 is over the value of $wgShowRollbackEditCount (default: 10) [[MediaWiki:Rollbacklinkcount-morethan/en|rollbacklinkcount-morethan]] is used',
+'rollbacklinkcount-morethan' => 'Similar to [[MediaWiki:Rollbacklinkcount/en|rollbacklinkcount]] but with prefix more than',
'rollbackfailed' => '{{Identical|Rollback}}',
'cantrollback' => '{{Identical|Revert}}
{{Identical|Rollback}}',