Debian Codegraph @

extensions/ConfirmEdit/includes/Store/CaptchaCacheStore.php

raw symbols SCIP
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 /** @var BagOStuff */
10 private $store;
11
12 public function __construct() {
13 parent::__construct();
14 $this->store = MediaWikiServices::getInstance()->getMicroStash();
15 }
16
17 /**
18 * @inheritDoc
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 // Assume the write will reach the master DC before the user sends the
28 // HTTP POST request attempted to solve the captcha and perform an action
29 $this->store::WRITE_BACKGROUND
30 );
31 }
32
33 /**
34 * @inheritDoc
35 */
36 public function retrieve( $index ) {
37 return $this->store->get( $this->store->makeKey( 'captcha', $index ) );
38 }
39
40 /**
41 * @inheritDoc
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' );