Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -1702,11 +1702,20 @@ |
1703 | 1703 | if( $wgFlaggedRevsAutopromote['excludeDeleted'] ) { |
1704 | 1704 | $dbr = isset($dbr) ? $dbr : wfGetDB( DB_SLAVE ); |
1705 | 1705 | $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 ) |
1711 | 1720 | return true; |
1712 | 1721 | } |
1713 | 1722 | # Add editor rights |