2013-06-28 23:18:10 +00:00
|
|
|
<?php
|
2022-04-08 16:53:12 +00:00
|
|
|
|
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\FancyCaptcha;
|
|
|
|
|
|
|
|
use ApiBase;
|
|
|
|
|
2013-01-17 02:00:09 +00:00
|
|
|
/**
|
|
|
|
* Api module to reload FancyCaptcha
|
|
|
|
*
|
|
|
|
* @ingroup API
|
|
|
|
* @ingroup Extensions
|
|
|
|
*/
|
|
|
|
class ApiFancyCaptchaReload extends ApiBase {
|
|
|
|
public function execute() {
|
|
|
|
# Get a new FancyCaptcha form data
|
|
|
|
$captcha = new FancyCaptcha();
|
2016-04-25 20:58:18 +00:00
|
|
|
$info = $captcha->getCaptcha();
|
|
|
|
$captchaIndex = $captcha->storeCaptcha( $info );
|
2013-01-17 02:00:09 +00:00
|
|
|
|
|
|
|
$result = $this->getResult();
|
2016-05-09 23:41:17 +00:00
|
|
|
$result->addValue( null, $this->getModuleName(), [ 'index' => $captchaIndex ] );
|
2013-01-17 02:00:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-14 23:29:18 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
2013-01-17 02:00:09 +00:00
|
|
|
public function getAllowedParams() {
|
2016-05-09 23:41:17 +00:00
|
|
|
return [];
|
2013-01-17 02:00:09 +00:00
|
|
|
}
|
|
|
|
|
2014-10-28 19:08:41 +00:00
|
|
|
/**
|
|
|
|
* @see ApiBase::getExamplesMessages()
|
2017-09-09 18:10:12 +00:00
|
|
|
* @return array
|
2014-10-28 19:08:41 +00:00
|
|
|
*/
|
|
|
|
protected function getExamplesMessages() {
|
2016-05-09 23:41:17 +00:00
|
|
|
return [
|
2014-10-28 19:08:41 +00:00
|
|
|
'action=fancycaptchareload'
|
|
|
|
=> 'apihelp-fancycaptchareload-example-1',
|
2016-05-09 23:41:17 +00:00
|
|
|
];
|
2014-10-28 19:08:41 +00:00
|
|
|
}
|
2013-01-17 02:00:09 +00:00
|
|
|
}
|