From: stronk7 Date: Fri, 10 Dec 2004 18:27:53 +0000 (+0000) Subject: Skipping empty categories in restore. They shouldn't exist but X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b5104c34f1d387e9fc3d61269c44c8cd0d956252;p=moodle.git Skipping empty categories in restore. They shouldn't exist but I've received some examples of this these days. Merged from MOODLE_14_STABLE --- diff --git a/backup/restorelib.php b/backup/restorelib.php index 2b62887649..d0e3f324e8 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -990,13 +990,16 @@ if ($info !== true) { //Iterate over each category foreach ($info as $category) { - $catrestore = "quiz_restore_question_categories"; - if (function_exists($catrestore)) { - //print_object ($category); //Debug - $status = $catrestore($category,$restore); - } else { - //Something was wrong. Function should exist. - $status = false; + //Skip empty categories (some backups can contain them) + if (!empty($category->id)) { + $catrestore = "quiz_restore_question_categories"; + if (function_exists($catrestore)) { + //print_object ($category); //Debug + $status = $catrestore($category,$restore); + } else { + //Something was wrong. Function should exist. + $status = false; + } } } }