mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Avoid "recent-contributors" queries that cause timeouts
* This works by only scanning the last 100 edits bug: T90036 Change-Id: I803b06f9eb7a4a61bcb0248520b4144158963983
This commit is contained in:
parent
6d316690a9
commit
42120d3921
|
@ -488,14 +488,20 @@ class AFComputedVariable {
|
|||
}
|
||||
|
||||
$dbr = wfGetDB( DB_SLAVE );
|
||||
$res = $dbr->select( 'revision',
|
||||
'DISTINCT rev_user_text',
|
||||
$sqlTmp = $dbr->selectSQLText(
|
||||
'revision',
|
||||
array( 'rev_user_text', 'rev_timestamp' ),
|
||||
array(
|
||||
'rev_page' => $title->getArticleID(),
|
||||
'rev_timestamp<' . $dbr->addQuotes( $dbr->timestamp( $cutOff ) )
|
||||
'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $cutOff ) )
|
||||
),
|
||||
__METHOD__,
|
||||
array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 10 )
|
||||
// Some pages have < 10 authors but many revisions (e.g. bot pages)
|
||||
array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 100 )
|
||||
);
|
||||
$res = $dbr->query(
|
||||
"SELECT rev_user_text FROM ($sqlTmp) AS tmp " .
|
||||
"GROUP BY rev_user_text ORDER BY MAX(rev_timestamp) DESC LIMIT 10"
|
||||
);
|
||||
|
||||
$users = array();
|
||||
|
|
Loading…
Reference in a new issue