Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1430005
CaptchaStore.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
CaptchaStore.php
View Options
<?php
namespace
MediaWiki\Extension\ConfirmEdit\Store
;
use
BadMethodCallException
;
use
MediaWiki\Config\ConfigException
;
use
MediaWiki\MediaWikiServices
;
abstract
class
CaptchaStore
{
/**
* Store the correct answer for a given captcha
* @param string $index
* @param array $info the captcha result
*/
abstract
public
function
store
(
$index
,
$info
);
/**
* Retrieve the answer for a given captcha
* @param string $index
* @return array|false
*/
abstract
public
function
retrieve
(
$index
);
/**
* Delete a result once the captcha has been used, so it cannot be reused
* @param string $index
*/
abstract
public
function
clear
(
$index
);
/**
* Whether this type of CaptchaStore needs cookies
* @return bool
*/
abstract
public
function
cookiesNeeded
();
/**
* The singleton instance
* @var CaptchaStore|null
*/
private
static
$instance
;
/**
* Get somewhere to store captcha data that will persist between requests
*
* @return CaptchaStore
*/
final
public
static
function
get
()
{
if
(
!
self
::
$instance
instanceof
self
)
{
$captchaStorageClass
=
MediaWikiServices
::
getInstance
()->
getMainConfig
()
->
get
(
'CaptchaStorageClass'
);
if
(
in_array
(
self
::
class
,
class_parents
(
$captchaStorageClass
)
)
)
{
self
::
$instance
=
new
$captchaStorageClass
;
}
else
{
throw
new
ConfigException
(
"Invalid CaptchaStore class $captchaStorageClass"
);
}
}
return
self
::
$instance
;
}
final
public
static
function
unsetInstanceForTests
()
{
if
(
!
defined
(
'MW_PHPUNIT_TEST'
)
)
{
throw
new
BadMethodCallException
(
'Cannot unset '
.
__CLASS__
.
' instance in operation.'
);
}
self
::
$instance
=
null
;
}
/**
* Protected constructor: no creating instances except through the factory method above
*/
protected
function
__construct
()
{
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 18:16 (7 h, 45 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e2/72/a477f0d6c468aa5c096d9ecf88a0
Default Alt Text
CaptchaStore.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment