11 abstract public function store( $index, $info );
24 abstract public function clear( $index );
44 final public static function get() {
45 if ( !self::$instance instanceof
self ) {
46 global $wgCaptchaStorageClass;
47 if ( in_array(
'CaptchaStore', class_parents( $wgCaptchaStorageClass ) ) ) {
48 self::$instance =
new $wgCaptchaStorageClass;
50 throw new Exception(
"Invalid CaptchaStore class $wgCaptchaStorageClass" );
57 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
58 throw new MWException(
'Cannot unset ' . __CLASS__ .
' instance in operation.' );
60 self::$instance =
null;
73 SessionManager::getGlobalSession()->persist();
76 function store( $index, $info ) {
77 SessionManager::getGlobalSession()->set(
'captcha' . $index, $info );
81 return SessionManager::getGlobalSession()->get(
'captcha' . $index,
false );
85 SessionManager::getGlobalSession()->remove(
'captcha' . $index );
94 function store( $index, $info ) {
95 global $wgCaptchaSessionExpiration;
97 ObjectCache::getMainStashInstance()->set(
100 $wgCaptchaSessionExpiration
105 $info = ObjectCache::getMainStashInstance()->get(
wfMemcKey(
'captcha', $index ) );
114 ObjectCache::getMainStashInstance()->delete(
wfMemcKey(
'captcha', $index ) );
125 public function store( $index, $info ) {
126 $this->data[$index] = $info;
130 if ( array_key_exists( $index, $this->data ) ) {
131 return $this->data[$index];
137 unset( $this->data[$index] );
wfMemcKey()
Make a cache key for the local wiki.
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.
cookiesNeeded()
Whether this type of CaptchaStore needs cookies.
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.
store( $index, $info)
Store the correct answer for a given captcha.
__construct()
Protected constructor: no creating instances except through the factory method above.
clear( $index)
Delete a result once the captcha has been used, so it cannot be reused.
cookiesNeeded()
Whether this type of CaptchaStore needs cookies.
retrieve( $index)
Retrieve the answer for a given captcha.
store( $index, $info)
Store the correct answer for a given captcha.
__construct()
Protected constructor: no creating instances except through the factory method above.
cookiesNeeded()
Whether this type of CaptchaStore needs cookies.
static unsetInstanceForTests()
clear( $index)
Delete a result once the captcha has been used, so it cannot be reused.
static CaptchaStore $instance
The singleton instance.
store( $index, $info)
Store the correct answer for a given captcha.
retrieve( $index)
Retrieve the answer for a given captcha.