MDL-21432 backup - solve problem deleting restore temp dirs, thanks SamH!
authorEloy Lafuente <stronk7@moodle.org>
Thu, 22 Jul 2010 10:33:27 +0000 (10:33 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Thu, 22 Jul 2010 10:33:27 +0000 (10:33 +0000)
backup/moodle2/restore_stepslib.php
backup/util/plan/restore_plan.class.php
backup/util/plan/restore_task.class.php

index be2bc8a..6a32dab 100644 (file)
@@ -59,9 +59,9 @@ class restore_drop_and_clean_temp_stuff extends restore_execution_step {
     protected function define_execution() {
         global $CFG;
         restore_controller_dbops::drop_restore_temp_tables($this->get_restoreid()); // Drop ids temp table
-        backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60));               // Delete > 4 hours temp dirs
+        backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60));              // Delete > 4 hours temp dirs
         if (empty($CFG->keeptempdirectoriesonbackup)) { // Conditionally
-            backup_helper::delete_backup_dir($this->get_restoreid()); // Empty backup dir
+            backup_helper::delete_backup_dir($this->task->get_tempdir()); // Empty restore dir
         }
     }
 }
@@ -546,7 +546,7 @@ class restore_course_structure_step extends restore_structure_step {
 
         $fullname  = $this->get_setting_value('course_fullname');
         $shortname = $this->get_setting_value('course_shortname');
-        $startdate  = $this->get_setting_value('course_startdate');
+        $startdate = $this->get_setting_value('course_startdate');
 
         // Calculate final course names, to avoid dupes
         list($fullname, $shortname) = restore_dbops::calculate_course_names($this->get_courseid(), $fullname, $shortname);
index 3909a1f..8dc4085 100644 (file)
@@ -97,6 +97,10 @@ class restore_plan extends base_plan implements loggable {
         return $this->preloaded;
     }
 
+    public function get_tempdir() {
+        return $this->controller->get_tempdir();
+    }
+
     public function log($message, $level, $a = null, $depth = null, $display = false) {
         backup_helper::log($message, $level, $a, $depth, $display, $this->get_logger());
     }
index 35ac466..776c2b1 100644 (file)
@@ -67,6 +67,10 @@ abstract class restore_task extends base_task {
         return $this->plan->get_preloaded_information();
     }
 
+    public function get_tempdir() {
+        return $this->plan->get_tempdir();
+    }
+
     public function get_old_contextid() {
         return $this->plan->get_info()->original_course_contextid;
     }