Browse files

MDL-38734: Automated backup failure causing all course to fail

  • Loading branch information...
1 parent 945aa97 commit 8beb495df4fa8661b3829470a5691f567e4ad751 @tlevi tlevi committed with danpoltawski Mar 27, 2013
Showing with 5 additions and 2 deletions.
  1. +1 −0 backup/moodle2/backup_stepslib.php
  2. +4 −2 backup/util/dbops/backup_controller_dbops.class.php
View
1 backup/moodle2/backup_stepslib.php
@@ -37,6 +37,7 @@ protected function define_execution() {
backup_helper::check_and_create_backup_dir($this->get_backupid());// Create backup temp dir
backup_helper::clear_backup_dir($this->get_backupid()); // Empty temp dir, just in case
backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60)); // Delete > 4 hours temp dirs
+ backup_controller_dbops::drop_backup_ids_temp_table($this->get_backupid()); // Drop ids temp table
backup_controller_dbops::create_backup_ids_temp_table($this->get_backupid()); // Create ids temp table
}
}
View
6 backup/util/dbops/backup_controller_dbops.class.php
@@ -164,8 +164,10 @@ public static function drop_backup_ids_temp_table($backupid) {
$dbman = $DB->get_manager(); // We are going to use database_manager services
$targettablename = 'backup_ids_temp';
- $table = new xmldb_table($targettablename);
- $dbman->drop_table($table); // And drop it
+ if ($dbman->table_exists($targettablename)) {
+ $table = new xmldb_table($targettablename);
+ $dbman->drop_table($table); // And drop it
+ }
}
/**

0 comments on commit 8beb495

Please sign in to comment.