mirror of
https://github.com/moodle/moodle.git
synced 2025-03-23 09:00:30 +01:00
Merge branch 'read-only-session' of https://github.com/Agilicus/moodle
This commit is contained in:
commit
da7feb3455
@ -259,8 +259,10 @@ class redis extends handler {
|
||||
$this->lock_session($id);
|
||||
}
|
||||
$sessiondata = $this->connection->get($id);
|
||||
if ($sessiondata === false && $this->requires_write_lock()) {
|
||||
$this->unlock_session($id);
|
||||
if ($sessiondata === false) {
|
||||
if ($this->requires_write_lock()) {
|
||||
$this->unlock_session($id);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
$this->connection->expire($id, $this->timeout);
|
||||
|
@ -91,6 +91,14 @@ class core_session_redis_testcase extends advanced_testcase {
|
||||
$this->redis->close();
|
||||
}
|
||||
|
||||
public function test_normal_session_read_only() {
|
||||
$sess = new \core\session\redis();
|
||||
$sess->set_requires_write_lock(false);
|
||||
$sess->init();
|
||||
$this->assertSame('', $sess->handler_read('sess1'));
|
||||
$this->assertTrue($sess->handler_close());
|
||||
}
|
||||
|
||||
public function test_normal_session_start_stop_works() {
|
||||
$sess = new \core\session\redis();
|
||||
$sess->init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user