mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-12-02 17:46:30 +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',
|
|
];
|
|
}
|
|
}
|