mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-28 07:42:48 +00:00
30cd1d8a23
Change-Id: I3fa9747e0ea970c5de39e2da8603e1bba9388a69
54 lines
999 B
PHP
54 lines
999 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\Store;
|
|
|
|
use BagOStuff;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
class CaptchaCacheStore extends CaptchaStore {
|
|
/** @var BagOStuff */
|
|
private $cache;
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
|
|
$this->cache = MediaWikiServices::getInstance()->getMainObjectStash();
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function store( $index, $info ) {
|
|
global $wgCaptchaSessionExpiration;
|
|
|
|
$cache = $this->cache;
|
|
$cache->set(
|
|
$cache->makeKey( 'captcha', $index ),
|
|
$info,
|
|
$wgCaptchaSessionExpiration
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function retrieve( $index ) {
|
|
$cache = $this->cache;
|
|
return $cache->get( $cache->makeKey( 'captcha', $index ) ) ?: false;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function clear( $index ) {
|
|
$cache = $this->cache;
|
|
$cache->delete( $cache->makeKey( 'captcha', $index ) );
|
|
}
|
|
|
|
public function cookiesNeeded() {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
class_alias( CaptchaCacheStore::class, 'CaptchaCacheStore' );
|