From 35055d3786f42f8ad3451f061564a800e514aa58 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 16 May 2004 18:05:02 +0000 Subject: [PATCH] Step4 done. :-) --- backup/backuplib.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index dd00072775..0b2e7b2374 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -941,13 +941,23 @@ $scales = get_records_sql("SELECT id, courseid, userid, name, scale, description, timemodified FROM {$CFG->prefix}scale WHERE courseid = '0' or courseid = $preferences->backup_course"); - - //Pring scales header + + //Copy only used scales to $backupscales. They will be in backup (unused no). See Bug 1223. + $backupscales = array(); if ($scales) { + foreach ($scales as $scale) { + if (course_scale_used($preferences->backup_course, $scale->id)) { + $backupscales[] = $scale; + } + } + } + + //Pring scales header + if ($backupscales) { //Pring scales header fwrite ($bf,start_tag("SCALES",2,true)); //Iterate - foreach ($scales as $scale) { + foreach ($backupscales as $scale) { //Begin scale tag fwrite ($bf,start_tag("SCALE",3,true)); //Output scale tag -- 2.39.5