mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 22:15:26 +00:00
a2ebd0c70a
Change-Id: Ibac10a20243a4eedd826485d56eddd5234da6fec
31 lines
668 B
PHP
31 lines
668 B
PHP
<?php
|
|
|
|
class ApiAbuseFilterEvalExpression extends ApiBase {
|
|
public function execute() {
|
|
$params = $this->extractRequestParams();
|
|
|
|
$result = AbuseFilter::evaluateExpression( $params['expression'] );
|
|
|
|
$this->getResult()->addValue( null, $this->getModuleName(), [ 'result' => $result ] );
|
|
}
|
|
|
|
public function getAllowedParams() {
|
|
return [
|
|
'expression' => [
|
|
ApiBase::PARAM_REQUIRED => true,
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @see ApiBase::getExamplesMessages()
|
|
* @return array
|
|
*/
|
|
protected function getExamplesMessages() {
|
|
return [
|
|
'action=abusefilterevalexpression&expression=lcase("FOO")'
|
|
=> 'apihelp-abusefilterevalexpression-example-1',
|
|
];
|
|
}
|
|
}
|