MDL-73317 report_participation: Close session later in script

The script has been reorganised so that it closes the session as early
as possible, without causing session changes after close being logged.

In this case, after the table has been output it is OK to close the
session.
This commit is contained in:
Matthew Hilton
2023-02-09 12:03:49 +10:00
parent 4faa3204d6
commit 863bad8d7e
+3 -2
View File
@@ -86,8 +86,6 @@ echo $OUTPUT->header();
// Print the selector dropdown.
$pluginname = get_string('pluginname', 'report_participation');
report_helper::print_report_selector($pluginname);
// Release session lock.
\core\session\manager::write_close();
// Logs will not have been recorded before the course timecreated time.
$minlog = $course->timecreated;
@@ -185,6 +183,9 @@ if (!empty($instanceid) && !empty($roleid)) {
));
$table->setup();
// Unlock the session only after outputting the table, since the table writes to the session.
\core\session\manager::write_close();
// We want to query both the current context and parent contexts.
list($relatedctxsql, $params) = $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');
$params['roleid'] = $roleid;