mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-12-21 09:52:48 +00:00
Avoid dynamic property for PHP 8.2 compatibility
Add a public method AbuseFilterChangesList that updates a map of RC IDs. I don't particularly like this approach, but I don't like the whole ChangesList situation either, so this should be fine for the time being. Bug: T381836 Change-Id: I0100ed64472de67cf4559f63f2c39eb2f882e0f5
This commit is contained in:
parent
6381b3051a
commit
5b321350e1
|
@ -20,6 +20,11 @@ class AbuseFilterChangesList extends OldChangesList {
|
|||
*/
|
||||
private $testFilter;
|
||||
|
||||
/**
|
||||
* @var array<int,bool> Maps RC IDs to a boolean indicating whether the RC would match a filter that is being tested
|
||||
*/
|
||||
private array $rcResults = [];
|
||||
|
||||
/**
|
||||
* @param IContextSource $context
|
||||
* @param string $testFilter
|
||||
|
@ -51,7 +56,8 @@ class AbuseFilterChangesList extends OldChangesList {
|
|||
$examineParams['testfilter'] = $this->testFilter;
|
||||
}
|
||||
|
||||
$title = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/' . $rc->getAttribute( 'rc_id' ) );
|
||||
$rcid = $rc->getAttribute( 'rc_id' );
|
||||
$title = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/' . $rcid );
|
||||
$examineLink = $this->linkRenderer->makeLink(
|
||||
$title,
|
||||
new HtmlArmor( $this->msg( 'abusefilter-changeslist-examine' )->parse() ),
|
||||
|
@ -62,8 +68,8 @@ class AbuseFilterChangesList extends OldChangesList {
|
|||
$s .= ' ' . $this->msg( 'parentheses' )->rawParams( $examineLink )->escaped();
|
||||
|
||||
// Add CSS classes for match and not match
|
||||
if ( isset( $rc->filterResult ) ) {
|
||||
$class = $rc->filterResult ?
|
||||
if ( isset( $this->rcResults[$rcid] ) ) {
|
||||
$class = $this->rcResults[$rcid] ?
|
||||
'mw-abusefilter-changeslist-match' :
|
||||
'mw-abusefilter-changeslist-nomatch';
|
||||
|
||||
|
@ -158,4 +164,9 @@ class AbuseFilterChangesList extends OldChangesList {
|
|||
public function insertRollback( &$s, &$rc ) {
|
||||
// Kill rollback links.
|
||||
}
|
||||
|
||||
public function setRCResult( RecentChange $rc, bool $matches ): void {
|
||||
$id = $rc->getAttribute( 'rc_id' );
|
||||
$this->rcResults[$id] = $matches;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,8 +298,7 @@ class AbuseFilterViewTestBatch extends AbuseFilterView {
|
|||
$result = $ruleChecker->checkConditions( $this->testPattern )->getResult();
|
||||
|
||||
if ( $result || $formData['ShowNegative'] ) {
|
||||
// Stash result in RC item
|
||||
$rc->filterResult = $result;
|
||||
$changesList->setRCResult( $rc, $result );
|
||||
$rc->counter = $counter++;
|
||||
$output .= $changesList->recentChangesLine( $rc, false );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue