diff --git a/includes/AFComputedVariable.php b/includes/AFComputedVariable.php index 4d958a4ff..918077690 100644 --- a/includes/AFComputedVariable.php +++ b/includes/AFComputedVariable.php @@ -409,17 +409,19 @@ class AFComputedVariable { $dbr = wfGetDB( DB_REPLICA ); $setOpts += Database::getCacheSetOptions( $dbr ); // Get the last 100 edit authors with a trivial query (avoid T116557) + $revQuery = Revision::getQueryInfo(); $revAuthors = $dbr->selectFieldValues( - 'revision', - 'rev_user_text', + $revQuery['tables'], + $revQuery['fields']['rev_user_text'], [ 'rev_page' => $title->getArticleID() ], __METHOD__, // Some pages have < 10 authors but many revisions (e.g. bot pages) [ 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 100, // Force index per T116557 - 'USE INDEX' => 'page_timestamp', - ] + 'USE INDEX' => [ 'revision' => 'page_timestamp' ], + ], + $revQuery['joins'] ); // Get the last 10 distinct authors within this set of edits $users = []; diff --git a/includes/AbuseFilter.hooks.php b/includes/AbuseFilter.hooks.php index 63950335f..07e289bdb 100644 --- a/includes/AbuseFilter.hooks.php +++ b/includes/AbuseFilter.hooks.php @@ -384,7 +384,7 @@ class AbuseFilterHooks { $action = $recentChange->mAttribs['rc_log_type'] ? $recentChange->mAttribs['rc_log_type'] : 'edit'; $actionID = implode( '-', [ - $title->getPrefixedText(), $recentChange->mAttribs['rc_user_text'], $action + $title->getPrefixedText(), $recentChange->getAttribute( 'rc_user_text' ), $action ] ); if ( isset( AbuseFilter::$tagsToSet[$actionID] ) ) { diff --git a/includes/Views/AbuseFilterViewTestBatch.php b/includes/Views/AbuseFilterViewTestBatch.php index 00f8dca74..0c5a464c7 100644 --- a/includes/Views/AbuseFilterViewTestBatch.php +++ b/includes/Views/AbuseFilterViewTestBatch.php @@ -92,7 +92,12 @@ class AbuseFilterViewTestBatch extends AbuseFilterView { $dbr = wfGetDB( DB_REPLICA ); $conds = []; - $conds['rc_user_text'] = $this->mTestUser; + + if ( (string)$this->mTestUser !== '' ) { + $conds[] = ActorMigration::newMigration()->getWhere( + $dbr, 'rc_user', User::newFromName( $this->mTestUser, false ) + )['conds']; + } if ( $this->mTestPeriodStart ) { $conds[] = 'rc_timestamp >= ' . diff --git a/includes/pagers/AbuseFilterExaminePager.php b/includes/pagers/AbuseFilterExaminePager.php index 6199c5d5e..c11d5c985 100644 --- a/includes/pagers/AbuseFilterExaminePager.php +++ b/includes/pagers/AbuseFilterExaminePager.php @@ -18,7 +18,12 @@ class AbuseFilterExaminePager extends ReverseChronologicalPager { function getQueryInfo() { $dbr = wfGetDB( DB_REPLICA ); $conds = []; - $conds['rc_user_text'] = $this->mPage->mSearchUser; + + if ( (string)$this->mPage->mSearchUser !== '' ) { + $conds[] = ActorMigration::newMigration()->getWhere( + $dbr, 'rc_user', User::newFromName( $this->mPage->mSearchUser, false ) + )['conds']; + } $startTS = strtotime( $this->mPage->mSearchPeriodStart ); if ( $startTS ) { diff --git a/maintenance/addMissingLoggingEntries.php b/maintenance/addMissingLoggingEntries.php index 5aa534386..2ad06afd2 100644 --- a/maintenance/addMissingLoggingEntries.php +++ b/maintenance/addMissingLoggingEntries.php @@ -72,19 +72,19 @@ class AddMissingLoggingEntries extends Maintenance { if ( $count % 100 == 0 ) { wfWaitForSlaves(); } + $user = User::newFromAnyId( $row->afh_user, $row->afh_user_text, null ); $dbw->insert( 'logging', [ 'log_type' => 'abusefilter', 'log_action' => 'modify', 'log_timestamp' => $row->afh_timestamp, - 'log_user' => $row->afh_user, 'log_namespace' => -1, 'log_title' => SpecialPageFactory::getLocalNameFor( 'AbuseFilter' ) . '/' . $row->afh_filter, 'log_params' => $row->afh_id . '\n' . $row->afh_filter, 'log_deleted' => $row->afh_deleted, - 'log_user_text' => $row->afh_user_text, - ] + CommentStore::getStore()->insert( $dbw, 'log_comment', '' ), + ] + CommentStore::getStore()->insert( $dbw, 'log_comment', '' ) + + ActorMigration::newMigration()->getInsertValues( $dbw, 'log_user', $user ), __METHOD__ ); $count++;