MDL-50798 question: Raise time limit when rendering questions

Rendering a large number of questions may be quite slow, so we want to
raise the limit.

We don’t call raise() in the loop because the quiz buffer captures this
function for a AJAX script, and we should only call raise if we expect
a corresponding output to the users browser. This helps to prevent
unexpected load balancer disconnects. See core_php_time_limit::raise()
for more details.
This commit is contained in:
Eric Merrill 2015-07-08 15:49:10 -04:00
parent e5eefbbf01
commit c7092fe489

View File

@ -664,6 +664,11 @@ class view {
$showquestiontext = false, $addcontexts = array()) {
global $CFG, $DB, $OUTPUT;
// This function can be moderately slow with large question counts and may time out.
// We probably do not want to raise it to unlimited, so randomly picking 5 minutes.
// Note: We do not call this in the loop because quiz ob_ captures this function (see raise() PHP doc).
\core_php_time_limit::raise(300);
$category = $this->get_current_category($categoryandcontext);
$strselectall = get_string('selectall');