mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-14 17:55:00 +00:00
Remove the hacky 'context' variable
First step for removing meta-variables, the second one being removing global_log_ids and local_log_ids. Change-Id: I01cd79771c0ee0865abaef6757a930aacd8138d2
This commit is contained in:
parent
6de4d426f0
commit
f700139215
|
@ -228,7 +228,7 @@ class AFComputedVariable {
|
|||
);
|
||||
|
||||
$logger = LoggerFactory::getInstance( 'AbuseFilter' );
|
||||
if ( $vars->getVar( 'context' )->toString() == 'filter' ) {
|
||||
if ( $vars->forFilter ) {
|
||||
$links = $this->getLinksFromDB( $article );
|
||||
$logger->debug( 'Loading old links from DB' );
|
||||
} elseif ( $article->getContentModel() === CONTENT_MODEL_WIKITEXT ) {
|
||||
|
|
|
@ -1116,7 +1116,7 @@ class AbuseFilter {
|
|||
Hooks::run( 'AbuseFilter-filterAction', [ &$vars, $title ] );
|
||||
$vars->addHolders( self::generateStaticVars() );
|
||||
|
||||
$vars->setVar( 'context', 'filter' );
|
||||
$vars->forFilter = true;
|
||||
$vars->setVar( 'timestamp', time() );
|
||||
|
||||
// Get the stash key based on the relevant "input" variables
|
||||
|
@ -2737,7 +2737,6 @@ class AbuseFilter {
|
|||
return null;
|
||||
}
|
||||
if ( $vars ) {
|
||||
$vars->setVar( 'context', 'generated' );
|
||||
$vars->setVar( 'timestamp', wfTimestamp( TS_UNIX, $row->rc_timestamp ) );
|
||||
$vars->addHolders( self::generateStaticVars() );
|
||||
}
|
||||
|
|
|
@ -5,7 +5,10 @@ class AbuseFilterVariableHolder {
|
|||
public $mVars = [];
|
||||
|
||||
/** @var string[] Variables used to store meta-data, we'd better be safe. See T191715 */
|
||||
public static $varBlacklist = [ 'context', 'global_log_ids', 'local_log_ids' ];
|
||||
public static $varBlacklist = [ 'global_log_ids', 'local_log_ids' ];
|
||||
|
||||
/** @var bool Whether this object is being used for an ongoing action being filtered */
|
||||
public $forFilter = false;
|
||||
|
||||
/** @var int 2 is the default and means that new variables names (from T173889) should be used.
|
||||
* 1 means that the old ones should be used, e.g. if this object is constructed from an
|
||||
|
@ -91,11 +94,6 @@ class AbuseFilterVariableHolder {
|
|||
}
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
// Reset the context.
|
||||
$this->setVar( 'context', 'stored' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Export all variables stored in this object as string
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue