]> git.mjollnir.org Git - moodle.git/commitdiff
Skipping empty categories in restore. They shouldn't exist but
authorstronk7 <stronk7>
Fri, 10 Dec 2004 18:27:53 +0000 (18:27 +0000)
committerstronk7 <stronk7>
Fri, 10 Dec 2004 18:27:53 +0000 (18:27 +0000)
I've received some examples of this these days.

Merged from MOODLE_14_STABLE

backup/restorelib.php

index 2b6288764955ebefe26281b162a8f01dfa243961..d0e3f324e8025250cc79e41539c5455334768209 100644 (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;
+                        }
                     }
                 }
             }