Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit f3593fc2cb5f545d366612d28d7cb81783560d9c 1 parent ba459c4
@stronk7 stronk7 authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 backup/util/helper/backup_cron_helper.class.php
View
12 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;
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.