From: toyomoyo Date: Wed, 30 May 2007 02:20:56 +0000 (+0000) Subject: during backup parent categories need to go before children X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a246d4d26950240759e361697d423283457549c2;p=moodle.git during backup parent categories need to go before children --- diff --git a/backup/backuplib.php b/backup/backuplib.php index 2f50ca422f..867e8e83af 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -1369,7 +1369,11 @@ //Output grade_category // getting grade categories, but make sure parents come before children - $grade_categories = get_records("grade_categories", "courseid", $preferences->backup_course); + // because when we do restore, we need to recover the parents first + // we do this by getting the lowest depth first + $grade_categories = get_records_sql("SELECT * FROM {$CFG->prefix}grade_categories + WHERE courseid = $preferences->backup_course + ORDER BY depth ASC"); if ($grade_categories) { //Begin grade_categories tag fwrite ($bf,start_tag("GRADE_CATEGORIES",3,true));