mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Use integers when calculating edit_delta
Since it'll always be a subtraction of integer numbers. Otherwise, if calculated as float, values won't triple-compare. Bug: T190652 Change-Id: Ia58a4e3429a012a94a43ffadb190154fcdb9bcaa
This commit is contained in:
parent
e18cd9b92d
commit
1de8740df7
|
@ -364,9 +364,9 @@ class AFComputedVariable {
|
|||
$s = $vars->getVar( $parameters['length-var'] )->toString();
|
||||
$result = strlen( $s );
|
||||
break;
|
||||
case 'subtract':
|
||||
$v1 = $vars->getVar( $parameters['val1-var'] )->toFloat();
|
||||
$v2 = $vars->getVar( $parameters['val2-var'] )->toFloat();
|
||||
case 'subtract-int':
|
||||
$v1 = $vars->getVar( $parameters['val1-var'] )->toInt();
|
||||
$v2 = $vars->getVar( $parameters['val2-var'] )->toInt();
|
||||
$result = $v1 - $v2;
|
||||
break;
|
||||
case 'revision-text-by-id':
|
||||
|
|
|
@ -2352,7 +2352,7 @@ class AbuseFilter {
|
|||
[ 'oldtext-var' => 'old_wikitext', 'newtext-var' => 'new_pst' ] );
|
||||
$vars->setLazyLoadVar( 'new_size', 'length', [ 'length-var' => 'new_wikitext' ] );
|
||||
$vars->setLazyLoadVar( 'old_size', 'length', [ 'length-var' => 'old_wikitext' ] );
|
||||
$vars->setLazyLoadVar( 'edit_delta', 'subtract',
|
||||
$vars->setLazyLoadVar( 'edit_delta', 'subtract-int',
|
||||
[ 'val1-var' => 'new_size', 'val2-var' => 'old_size' ] );
|
||||
|
||||
// Some more specific/useful details about the changes.
|
||||
|
|
Loading…
Reference in a new issue