mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-18 02:41:01 +00:00
a801949300
Existed since 1.39 in I3fa9747e0ea970c5de39e2da8603e1bba9388a69 Change-Id: I17a648aaf7644d00cd82966a88dab8f33d2e317f
51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\Store;
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
use Wikimedia\ObjectCache\BagOStuff;
|
|
|
|
class CaptchaCacheStore extends CaptchaStore {
|
|
/** @var BagOStuff */
|
|
private $store;
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->store = MediaWikiServices::getInstance()->getMicroStash();
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function store( $index, $info ) {
|
|
global $wgCaptchaSessionExpiration;
|
|
|
|
$this->store->set(
|
|
$this->store->makeKey( 'captcha', $index ),
|
|
$info,
|
|
$wgCaptchaSessionExpiration,
|
|
// Assume the write will reach the master DC before the user sends the
|
|
// HTTP POST request attempted to solve the captcha and perform an action
|
|
$this->store::WRITE_BACKGROUND
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function retrieve( $index ) {
|
|
return $this->store->get( $this->store->makeKey( 'captcha', $index ) );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function clear( $index ) {
|
|
$this->store->delete( $this->store->makeKey( 'captcha', $index ) );
|
|
}
|
|
|
|
public function cookiesNeeded() {
|
|
return false;
|
|
}
|
|
}
|