]> git.mjollnir.org Git - moodle.git/commitdiff
add an override for system limits (execution time / memory limit) for long
authordiml <diml>
Sun, 7 Oct 2007 20:14:17 +0000 (20:14 +0000)
committerdiml <diml>
Sun, 7 Oct 2007 20:14:17 +0000 (20:14 +0000)
reindexation works (big documents). Set statically to 300 sec and 48M.

TODO : get possibly admin defined values for these limits.

search/cron_php5.php

index 168671cc25fa7f6ac83dbc2455acfcabb8f8a795..4aa4b4347ad9224768dbb412bb397683cb8ddd83 100644 (file)
@@ -5,6 +5,12 @@
 * Should never be called by a php 4.3.0 implementation. 
 */
 try{
+    // overrides php limits
+    $maxtimelimit = ini_get('max_execution_time');
+    ini_set('max_execution_time', 300);
+    $maxmemoryamount = ini_get('memory_limit');
+    ini_set('memory_limit', '48M');
+
     mtrace("<pre>Starting cron...\n");
     mtrace("--DELETE----");
     require_once("$CFG->dirroot/search/delete.php");
@@ -14,6 +20,10 @@ try{
     require_once("$CFG->dirroot/search/add.php");
     mtrace("------------");
     mtrace("cron finished.</pre>");
+
+    // set back normal values for php limits
+    ini_set('max_execution_time', $maxtimelimit);
+    ini_set('memory_limit', $maxmemoryamount);
 }
 catch(Exception $ex){
     mtrace('Fatal exception from Lucene subsystem. Search engine may not have been updated.');