Merge "Make parser aware of the filter it is parsing"

This commit is contained in:
jenkins-bot 2019-08-20 12:50:26 +00:00 committed by Gerrit Code Review
commit d0b30c2534
2 changed files with 14 additions and 0 deletions

View file

@ -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;

View file

@ -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;
}
/**