MDL-73317 search: Close session later in script

The session write_close was moved to the earliest point in the script
that does not modify the session. This is currently always after
$OUTPUT->header()
This commit is contained in:
Matthew Hilton 2022-09-16 10:49:32 +10:00
parent 49c4cfb2d5
commit f106babf53

View File

@ -48,9 +48,6 @@ if (!empty($CFG->forcelogin)) {
require_login();
}
// Unlock the session during a search.
\core\session\manager::write_close();
require_capability('moodle/search:query', $context);
$searchrenderer = $PAGE->get_renderer('core_search');
@ -169,6 +166,9 @@ $PAGE->set_url($url);
// We are ready to render.
echo $OUTPUT->header();
// Unlock the session only after outputting the header as this modifies the session cachestore.
\core\session\manager::write_close();
// Get the results.
if ($data) {
$results = $search->paged_search($data, $page);