mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Merge "Make parser aware of the filter it is parsing"
This commit is contained in:
commit
d0b30c2534
|
@ -377,6 +377,7 @@ class AbuseFilterRunner {
|
|||
AbuseFilter::cacheFilter( $filterName, $row );
|
||||
|
||||
$pattern = trim( $row->af_pattern );
|
||||
$this->parser->setFilter( $filterName );
|
||||
$result = AbuseFilter::checkConditions( $pattern, $this->parser, true, $filterName );
|
||||
|
||||
$actualExtra = AFComputedVariable::$profilingExtraTime - $origExtraTime;
|
||||
|
|
|
@ -40,6 +40,11 @@ class AbuseFilterParser {
|
|||
*/
|
||||
protected $condLimitEnabled = true;
|
||||
|
||||
/**
|
||||
* @var string|null The ID of the filter being parsed, if available. Can also be "global-$ID"
|
||||
*/
|
||||
protected $mFilter;
|
||||
|
||||
public static $mFunctions = [
|
||||
'lcase' => 'funcLc',
|
||||
'ucase' => 'funcUc',
|
||||
|
@ -110,6 +115,13 @@ class AbuseFilterParser {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filter
|
||||
*/
|
||||
public function setFilter( $filter ) {
|
||||
$this->mFilter = $filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
|
@ -158,6 +170,7 @@ class AbuseFilterParser {
|
|||
$this->mShortCircuit = false;
|
||||
$this->mAllowShort = true;
|
||||
$this->mCondCount = 0;
|
||||
$this->mFilter = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue