mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-12 00:38:23 +00:00
Merge "Update for the actor table change"
This commit is contained in:
commit
6d32b24d16
|
@ -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 = [];
|
||||
|
|
|
@ -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] ) ) {
|
||||
|
|
|
@ -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 >= ' .
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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++;
|
||||
|
|
Loading…
Reference in a new issue