From 4d1aead12e551bc074bee0c3c4664b353b2a1ec1 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 10 Dec 2004 18:25:45 +0000 Subject: [PATCH] Skipping empty categories in restore. They shouldn't exist but I've received some examples of this these days. --- backup/restorelib.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/backup/restorelib.php b/backup/restorelib.php index 52a0d88ace0..1dd612a0c44 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -937,13 +937,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; + } } } }