2017-12-16 12:32:46 +00:00
|
|
|
<?php
|
|
|
|
|
2022-04-08 16:40:15 +00:00
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\Store;
|
|
|
|
|
2017-12-16 12:32:46 +00:00
|
|
|
use MediaWiki\Session\SessionManager;
|
|
|
|
|
|
|
|
class CaptchaSessionStore extends CaptchaStore {
|
|
|
|
protected function __construct() {
|
|
|
|
// Make sure the session is started
|
|
|
|
SessionManager::getGlobalSession()->persist();
|
|
|
|
}
|
|
|
|
|
2020-04-14 23:29:18 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
2018-06-15 21:08:14 +00:00
|
|
|
public function store( $index, $info ) {
|
2017-12-16 12:32:46 +00:00
|
|
|
SessionManager::getGlobalSession()->set( 'captcha' . $index, $info );
|
|
|
|
}
|
|
|
|
|
2020-04-14 23:29:18 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
2018-06-15 21:08:14 +00:00
|
|
|
public function retrieve( $index ) {
|
2017-12-16 12:32:46 +00:00
|
|
|
return SessionManager::getGlobalSession()->get( 'captcha' . $index, false );
|
|
|
|
}
|
|
|
|
|
2020-04-14 23:29:18 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
2018-06-15 21:08:14 +00:00
|
|
|
public function clear( $index ) {
|
2017-12-16 12:32:46 +00:00
|
|
|
SessionManager::getGlobalSession()->remove( 'captcha' . $index );
|
|
|
|
}
|
|
|
|
|
2018-06-15 21:08:14 +00:00
|
|
|
public function cookiesNeeded() {
|
2017-12-16 12:32:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|