Permalink
Browse files

MDL-33364 automated backup: return and log each course result correctly

  • Loading branch information...
1 parent ba459c4 commit f3593fc2cb5f545d366612d28d7cb81783560d9c @stronk7 stronk7 committed May 28, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 backup/util/helper/backup_cron_helper.class.php
@@ -315,6 +315,7 @@ public static function calculate_next_automated_backup($timezone, $now) {
*/
public static function launch_automated_backup($course, $starttime, $userid) {
+ $outcome = true;
$config = get_config('backup');
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id, backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_AUTOMATED, $userid);
@@ -347,7 +348,7 @@ public static function launch_automated_backup($course, $starttime, $userid) {
$bc->set_status(backup::STATUS_AWAITING);
- $outcome = $bc->execute_plan();
+ $bc->execute_plan();
$results = $bc->get_results();
$file = $results['backup_destination'];
$dir = $config->backup_auto_destination;
@@ -363,16 +364,17 @@ public static function launch_automated_backup($course, $starttime, $userid) {
}
}
- $outcome = true;
- } catch (backup_exception $e) {
- $bc->log('backup_auto_failed_on_course', backup::LOG_WARNING, $course->shortname);
+ } catch (moodle_exception $e) {
+ $bc->log('backup_auto_failed_on_course', backup::LOG_ERROR, $course->shortname); // Log error header.
+ $bc->log('Exception: ' . $e->errorcode, backup::LOG_ERROR, $e->a, 1); // Log original exception problem.
+ $bc->log('Debug: ' . $e->debuginfo, backup::LOG_DEBUG, null, 1); // Log original debug information.
$outcome = false;
}
$bc->destroy();
unset($bc);
- return true;
+ return $outcome;
}
/**

0 comments on commit f3593fc

Please sign in to comment.