MDL-72670 session: Correct read only debugging logic

Prior to this patch the debugging mode (when enabled) would trigger
on everywhere, regardless of whether or not READ_ONLY_SESSION is defined.

This patch modifies that behaviour so that the debugging only kicks in
if READ_ONLY_SESSION is defined and set to true.
This commit is contained in:
Cameron Ball 2021-09-24 14:09:34 +08:00
parent 70073fdc74
commit d5eaa5224e
3 changed files with 34 additions and 5 deletions

View file

@ -198,7 +198,7 @@ class external_api {
// Eventually this should shift into the various handlers and not be handled via config.
$readonlysession = $externalfunctioninfo->readonlysession ?? false;
if (!$readonlysession || empty($CFG->enable_read_only_sessions)) {
\core\session\manager::restart_with_write_lock();
\core\session\manager::restart_with_write_lock($readonlysession);
}
$currentpage = $PAGE;