MDL-41230 tool_uploadcourse: Prevent max_execution_time issues
authorFrederic Massart <fred@moodle.com>
Thu, 3 Oct 2013 03:44:54 +0000 (11:44 +0800)
committerFrederic Massart <fred@moodle.com>
Thu, 3 Oct 2013 03:44:54 +0000 (11:44 +0800)
admin/tool/uploadcourse/classes/processor.php

index 79b10ed..7113ded 100644 (file)
@@ -194,6 +194,10 @@ class tool_uploadcourse_processor {
         $deleted = 0;
         $errors = 0;
 
+        // We will most certainly need extra time and memory to process big files.
+        @set_time_limit(0);
+        raise_memory_limit(MEMORY_EXTRA);
+
         // Loop over the CSV lines.
         while ($line = $this->cir->next()) {
             $this->linenb++;
@@ -330,6 +334,10 @@ class tool_uploadcourse_processor {
         }
         $tracker->start();
 
+        // We might need extra time and memory depending on the number of rows to preview.
+        @set_time_limit(0);
+        raise_memory_limit(MEMORY_EXTRA);
+
         // Loop over the CSV lines.
         $preview = array();
         while (($line = $this->cir->next()) && $rows > $this->linenb) {