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();
|
|
|
|
}
|
|
|
|
|
2024-10-25 18:24:07 +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 );
|
|
|
|
}
|
|
|
|
|
2024-10-25 18:24:07 +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 );
|
|
|
|
}
|
|
|
|
|
2024-10-25 18:24:07 +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 );
|
|
|
|
}
|
|
|
|
|
2024-10-25 18:24:07 +00:00
|
|
|
/** @inheritDoc */
|
2018-06-15 21:08:14 +00:00
|
|
|
public function cookiesNeeded() {
|
2017-12-16 12:32:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|