Merge branch 'MDL-80281_401_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_401_STABLE

This commit is contained in:
Jun Pataleta
2023-12-07 10:16:38 +08:00
+15 -12
View File
@@ -159,9 +159,11 @@ class manager {
throw new \core\session\exception(get_string('servererror'));
}
// Grab the time when session lock starts.
$PERF->sessionlock['gained'] = microtime(true);
$PERF->sessionlock['wait'] = $PERF->sessionlock['gained'] - $PERF->sessionlock['start'];
if ($requireslock) {
// Grab the time when session lock starts.
$PERF->sessionlock['gained'] = microtime(true);
$PERF->sessionlock['wait'] = $PERF->sessionlock['gained'] - $PERF->sessionlock['start'];
}
self::initialise_user_session($isnewsession);
self::$sessionactive = true; // Set here, so the session can be cleared if the security check fails.
self::check_security();
@@ -686,16 +688,17 @@ class manager {
global $PERF, $ME, $CFG;
if (self::$sessionactive) {
// Grab the time when session lock is released.
$PERF->sessionlock['released'] = microtime(true);
if (!empty($PERF->sessionlock['gained'])) {
$PERF->sessionlock['held'] = $PERF->sessionlock['released'] - $PERF->sessionlock['gained'];
}
$PERF->sessionlock['url'] = me();
self::update_recent_session_locks($PERF->sessionlock);
self::sessionlock_debugging();
$requireslock = self::$handler->requires_write_lock();
if ($requireslock) {
// Grab the time when session lock is released.
$PERF->sessionlock['released'] = microtime(true);
if (!empty($PERF->sessionlock['gained'])) {
$PERF->sessionlock['held'] = $PERF->sessionlock['released'] - $PERF->sessionlock['gained'];
}
$PERF->sessionlock['url'] = me();
self::update_recent_session_locks($PERF->sessionlock);
self::sessionlock_debugging();
}
if (!$requireslock || !self::$requireslockdebug) {
// Compare the array of the earlier session data with the array now, if
// there is a difference then a lock is required.