From 92c067f61735805cfb4f22c2ddea1aa9392c8dc6 Mon Sep 17 00:00:00 2001 From: Eric Merrill Date: Wed, 8 Jul 2015 15:49:10 -0400 Subject: [PATCH] MDL-50798 question: Raise time limit when rendering questions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- question/classes/bank/view.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/question/classes/bank/view.php b/question/classes/bank/view.php index cc93016b6dc..98ba1f7ebb0 100644 --- a/question/classes/bank/view.php +++ b/question/classes/bank/view.php @@ -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');