| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\ConfirmEdit\Store; |
| 4 |
|
| 5 |
use MediaWiki\MediaWikiServices; |
| 6 |
use Wikimedia\ObjectCache\BagOStuff; |
| 7 |
|
| 8 |
class CaptchaCacheStore extends CaptchaStore { |
| 9 |
|
| 10 |
private $store; |
| 11 |
|
| 12 |
public function __construct() { |
| 13 |
parent::__construct(); |
| 14 |
$this->store = MediaWikiServices::getInstance()->getMicroStash(); |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public function store( $index, $info ) { |
| 21 |
global $wgCaptchaSessionExpiration; |
| 22 |
|
| 23 |
$this->store->set( |
| 24 |
$this->store->makeKey( 'captcha', $index ), |
| 25 |
$info, |
| 26 |
$wgCaptchaSessionExpiration, |
| 27 |
|
| 28 |
|
| 29 |
$this->store::WRITE_BACKGROUND |
| 30 |
); |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public function retrieve( $index ) { |
| 37 |
return $this->store->get( $this->store->makeKey( 'captcha', $index ) ); |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
public function clear( $index ) { |
| 44 |
$this->store->delete( $this->store->makeKey( 'captcha', $index ) ); |
| 45 |
} |
| 46 |
|
| 47 |
public function cookiesNeeded() { |
| 48 |
return false; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
class_alias( CaptchaCacheStore::class, 'CaptchaCacheStore' ); |