MediaWiki REL1_34
CaptchaCacheStore.php
Go to the documentation of this file.
1<?php
2
4
7 private $cache;
8
9 public function __construct() {
10 parent::__construct();
11
12 $this->cache = MediaWikiServices::getInstance()->getMainObjectStash();
13 }
14
15 public function store( $index, $info ) {
16 global $wgCaptchaSessionExpiration;
17
19 $cache->set(
20 $cache->makeKey( 'captcha', $index ),
21 $info,
22 $wgCaptchaSessionExpiration
23 );
24 }
25
26 public function retrieve( $index ) {
28 $info = $cache->get( $cache->makeKey( 'captcha', $index ) );
29 if ( $info ) {
30 return $info;
31 } else {
32 return false;
33 }
34 }
35
36 public function clear( $index ) {
38 $cache->delete( $cache->makeKey( 'captcha', $index ) );
39 }
40
41 public function cookiesNeeded() {
42 return false;
43 }
44}
Class representing a cache/ephemeral data store.
Definition BagOStuff.php:63
get( $key, $flags=0)
Get an item with the given key.
makeKey( $class,... $components)
Make a cache key, scoped to this instance's keyspace.
delete( $key, $flags=0)
Delete an item.
set( $key, $value, $exptime=0, $flags=0)
Set an item.
retrieve( $index)
Retrieve the answer for a given captcha.
clear( $index)
Delete a result once the captcha has been used, so it cannot be reused.
cookiesNeeded()
Whether this type of CaptchaStore needs cookies.
store( $index, $info)
Store the correct answer for a given captcha.
__construct()
Protected constructor: no creating instances except through the factory method above.
MediaWikiServices is the service locator for the application scope of MediaWiki.