Permalink
Browse files

MDL-34612 Restore: Gracefully handle empty section title while restoring

  • Loading branch information...
1 parent b6ced2f commit 4db18636875ac4902b3e306bf843d71d851f1827 Rajesh Taneja committed Oct 15, 2013
Showing with 4 additions and 0 deletions.
  1. +3 −0 backup/moodle2/restore_section_task.class.php
  2. +1 −0 lang/en/backup.php
@@ -161,6 +161,9 @@ protected function define_settings() {
$section_included = new restore_section_included_setting($settingname, base_setting::IS_BOOLEAN, true);
if (is_number($this->info->title)) {
$label = get_string('includesection', 'backup', $this->info->title);
+ } elseif (empty($this->info->title)) { // Don't throw error if title is empty, gracefully continue restore.
+ $this->log('Section title missing in backup for section id '.$this->info->sectionid, backup::LOG_WARNING, $this->name);
+ $label = get_string('unnamedsection', 'backup');
} else {
$label = $this->info->title;
}
View
@@ -248,6 +248,7 @@
$string['title'] = 'Title';
$string['totalcategorysearchresults'] = 'Total categories: {$a}';
$string['totalcoursesearchresults'] = 'Total courses: {$a}';
+$string['unnamedsection'] = 'Unnamed section';
$string['userinfo'] = 'Userinfo';
$string['module'] = 'Module';
$string['morecoursesearchresults'] = 'More than {$a} courses found, showing first {$a} results';

0 comments on commit 4db1863

Please sign in to comment.