Skip to content

Commit

Permalink
MDL-24684 backup - basic protection against time/memory limits
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jun 30, 2011
1 parent 7fde489 commit b7a45fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backup/controller/backup_controller.class.php
Expand Up @@ -290,6 +290,9 @@ public function get_logger() {
* @return void Throws and exception of completes * @return void Throws and exception of completes
*/ */
public function execute_plan() { 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(); return $this->plan->execute();
} }


Expand Down
7 changes: 7 additions & 0 deletions backup/controller/restore_controller.class.php
Expand Up @@ -296,6 +296,9 @@ public function get_logger() {
} }


public function execute_plan() { 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(); return $this->plan->execute();
} }


Expand Down Expand Up @@ -383,6 +386,10 @@ public function convert() {
global $CFG; global $CFG;
require_once($CFG->dirroot . '/backup/util/helper/convert_helper.class.php'); 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) { if ($this->status != backup::STATUS_REQUIRE_CONV) {
throw new restore_controller_exception('cannot_convert_not_required_status'); throw new restore_controller_exception('cannot_convert_not_required_status');
} }
Expand Down

0 comments on commit b7a45fa

Please sign in to comment.