2011-08-26 20:12:34 +00:00
|
|
|
<?php
|
|
|
|
|
2011-09-29 23:30:42 +00:00
|
|
|
class ApiAbuseFilterEvalExpression extends ApiBase {
|
2011-08-26 20:12:34 +00:00
|
|
|
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,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-10-28 16:25:22 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since MediaWiki core 1.25
|
|
|
|
*/
|
2011-08-26 20:12:34 +00:00
|
|
|
public function getParamDescription() {
|
|
|
|
return array(
|
|
|
|
'expression' => 'The expression to evaluate',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-10-28 16:25:22 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since MediaWiki core 1.25
|
|
|
|
*/
|
2011-08-26 20:12:34 +00:00
|
|
|
public function getDescription() {
|
|
|
|
return array(
|
|
|
|
'Evaluates an AbuseFilter expression'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-10-28 16:25:22 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since MediaWiki core 1.25
|
|
|
|
*/
|
2011-08-26 20:12:34 +00:00
|
|
|
public function getExamples() {
|
|
|
|
return array(
|
2012-01-13 21:36:51 +00:00
|
|
|
'api.php?action=abusefilterevalexpression&expression=lcase("FOO")'
|
2011-08-26 20:12:34 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-10-28 16:25:22 +00:00
|
|
|
/**
|
|
|
|
* @see ApiBase::getExamplesMessages()
|
|
|
|
*/
|
|
|
|
protected function getExamplesMessages() {
|
|
|
|
return array(
|
|
|
|
'action=abusefilterevalexpression&expression=lcase("FOO")'
|
|
|
|
=> 'apihelp-abusefilterevalexpression-example-1',
|
|
|
|
);
|
2011-08-26 20:12:34 +00:00
|
|
|
}
|
|
|
|
}
|