mediawiki-extensions-AbuseF.../api/ApiAbuseFilterEvalExpression.php
Brad Jorsch 3aa76b0f5f Remove pre-1.25 API compatibility code
Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: I6f968be3b7ef7cbc7193c8e103beb36ecf9c7b60
2016-09-20 15:31:58 -04:00

30 lines
670 B
PHP

<?php
class ApiAbuseFilterEvalExpression extends ApiBase {
public function execute() {
$params = $this->extractRequestParams();
$result = AbuseFilter::evaluateExpression( $params['expression'] );
$this->getResult()->addValue( null, $this->getModuleName(), array( 'result' => $result ) );
}
public function getAllowedParams() {
return array(
'expression' => array(
ApiBase::PARAM_REQUIRED => true,
),
);
}
/**
* @see ApiBase::getExamplesMessages()
*/
protected function getExamplesMessages() {
return array(
'action=abusefilterevalexpression&expression=lcase("FOO")'
=> 'apihelp-abusefilterevalexpression-example-1',
);
}
}