Permalink
Browse files

Skipping empty categories in restore. They shouldn't exist but

I've received some examples of this these days.
  • Loading branch information...
1 parent c492f5f commit 4d1aead12e551bc074bee0c3c4664b353b2a1ec1 stronk7 committed Dec 10, 2004
Showing with 10 additions and 7 deletions.
  1. +10 −7 backup/restorelib.php
View
17 backup/restorelib.php
@@ -937,13 +937,16 @@ function restore_create_questions($restore,$xml_file) {
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;
+ }
}
}
}

0 comments on commit 4d1aead

Please sign in to comment.