mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-36211 do not lock sessions for guests and not-logged-in users
This commit is contained in:
parent
2d7c5eeeea
commit
46a86dbbc2
8 changed files with 47 additions and 7 deletions
|
@ -341,11 +341,11 @@ abstract class moodle_database {
|
|||
}
|
||||
$this->force_transaction_rollback();
|
||||
}
|
||||
if ($this->used_for_db_sessions) {
|
||||
// this is needed because we need to save session to db before closing it
|
||||
session_get_instance()->write_close();
|
||||
$this->used_for_db_sessions = false;
|
||||
}
|
||||
// Always terminate sessions here to make it consistent,
|
||||
// this is needed because we need to save session to db before closing it.
|
||||
session_get_instance()->write_close();
|
||||
$this->used_for_db_sessions = false;
|
||||
|
||||
if ($this->temptables) {
|
||||
$this->temptables->dispose();
|
||||
$this->temptables = null;
|
||||
|
|
|
@ -1296,6 +1296,10 @@ s only returning name of SQL substring function, it now requires all parameters.
|
|||
if (!$this->session_lock_supported()) {
|
||||
return;
|
||||
}
|
||||
if (!$this->used_for_db_sessions) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::release_session_lock($rowid);
|
||||
|
||||
$fullname = $this->dbname.'-'.$this->prefix.'-session-'.$rowid;
|
||||
|
|
|
@ -1451,6 +1451,10 @@ class mysqli_native_moodle_database extends moodle_database {
|
|||
}
|
||||
|
||||
public function release_session_lock($rowid) {
|
||||
if (!$this->used_for_db_sessions) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::release_session_lock($rowid);
|
||||
$fullname = $this->dbname.'-'.$this->prefix.'-session-'.$rowid;
|
||||
$sql = "SELECT RELEASE_LOCK('$fullname')";
|
||||
|
|
|
@ -1649,6 +1649,10 @@ class oci_native_moodle_database extends moodle_database {
|
|||
if (!$this->session_lock_supported()) {
|
||||
return;
|
||||
}
|
||||
if (!$this->used_for_db_sessions) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::release_session_lock($rowid);
|
||||
|
||||
$fullname = $this->dbname.'-'.$this->prefix.'-session-'.$rowid;
|
||||
|
|
|
@ -1289,6 +1289,10 @@ class pgsql_native_moodle_database extends moodle_database {
|
|||
if (!$this->session_lock_supported()) {
|
||||
return;
|
||||
}
|
||||
if (!$this->used_for_db_sessions) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::release_session_lock($rowid);
|
||||
|
||||
$sql = "SELECT pg_advisory_unlock($rowid)";
|
||||
|
|
|
@ -1347,6 +1347,10 @@ class sqlsrv_native_moodle_database extends moodle_database {
|
|||
if (!$this->session_lock_supported()) {
|
||||
return;
|
||||
}
|
||||
if (!$this->used_for_db_sessions) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::release_session_lock($rowid);
|
||||
|
||||
$fullname = $this->dbname.'-'.$this->prefix.'-session-'.$rowid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue