mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-28 07:50:24 +00:00
2f250127b4
Aka move all code into includes/. Change-Id: I21f7b80bb6df04abbed6bfccb94f92100dc8f071
30 lines
650 B
PHP
30 lines
650 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()
|
|
*/
|
|
protected function getExamplesMessages() {
|
|
return [
|
|
'action=abusefilterevalexpression&expression=lcase("FOO")'
|
|
=> 'apihelp-abusefilterevalexpression-example-1',
|
|
];
|
|
}
|
|
}
|