Browse files

MDL-24684 backup - basic protection against time/memory limits

  • Loading branch information...
1 parent 7fde489 commit b7a45fa7826c1bc022725b9baf87bb9a8257c2ba @stronk7 stronk7 committed Jun 30, 2011
Showing with 10 additions and 0 deletions.
  1. +3 −0 backup/controller/backup_controller.class.php
  2. +7 −0 backup/controller/restore_controller.class.php
View
3 backup/controller/backup_controller.class.php
@@ -290,6 +290,9 @@ public function get_logger() {
* @return void Throws and exception of completes
*/
public function execute_plan() {
+ // Basic/initial prevention against time/memory limits
+ set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
+ raise_memory_limit(MEMORY_EXTRA);
return $this->plan->execute();
}
View
7 backup/controller/restore_controller.class.php
@@ -296,6 +296,9 @@ public function get_logger() {
}
public function execute_plan() {
+ // Basic/initial prevention against time/memory limits
+ set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
+ raise_memory_limit(MEMORY_EXTRA);
return $this->plan->execute();
}
@@ -383,6 +386,10 @@ public function convert() {
global $CFG;
require_once($CFG->dirroot . '/backup/util/helper/convert_helper.class.php');
+ // Basic/initial prevention against time/memory limits
+ set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
+ raise_memory_limit(MEMORY_EXTRA);
+
if ($this->status != backup::STATUS_REQUIRE_CONV) {
throw new restore_controller_exception('cannot_convert_not_required_status');
}

0 comments on commit b7a45fa

Please sign in to comment.