r32801 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32800‎ | r32801 | r32802 >
Date:02:22, 5 April 2008
Author:aaron
Status:old
Tags:
Comment:
Use estimates
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -1702,11 +1702,20 @@
17031703 if( $wgFlaggedRevsAutopromote['excludeDeleted'] ) {
17041704 $dbr = isset($dbr) ? $dbr : wfGetDB( DB_SLAVE );
17051705 $minDiff = $user->getEditCount() - $wgFlaggedRevsAutopromote['days'] + 1;
1706 - $dbr->select( 'archive', '1',
1707 - array( 'ar_user_text' => $user->getName() ),
1708 - __METHOD__,
1709 - array( 'USE INDEX' => 'usertext_timestamp', 'LIMIT' => $minDiff ) );
1710 - if( $dbr->numRows() >= $minDiff )
 1706+ # Use an estimate if the number starts to get large
 1707+ if( $minDiff <= 100 ) {
 1708+ $dbr->select( 'archive', '1',
 1709+ array( 'ar_user_text' => $user->getName() ),
 1710+ __METHOD__,
 1711+ array( 'USE INDEX' => 'usertext_timestamp', 'LIMIT' => $minDiff ) );
 1712+ $deletedEdits = $dbr->numRows();
 1713+ } else {
 1714+ $deletedEdits = $dbr->estimateRowCount( 'archive', '1',
 1715+ array( 'ar_user_text' => $user->getName() ),
 1716+ __METHOD__,
 1717+ array( 'USE INDEX' => 'usertext_timestamp' ) );
 1718+ }
 1719+ if( $deletedEdits >= $minDiff )
17111720 return true;
17121721 }
17131722 # Add editor rights

Status & tagging log