From c65d1af55779a2187a1b872555ec53d81d86ebc0 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 23 May 2006 18:38:24 +0000 Subject: [PATCH] fixed file backup and converted other forgotten "assignments"; merged from MOODLE_16_STABLE --- mod/data/backuplib.php | 18 ++++++++---------- mod/data/restorelib.php | 17 ++++++++--------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/mod/data/backuplib.php b/mod/data/backuplib.php index 9d86756d43..280cd09fac 100644 --- a/mod/data/backuplib.php +++ b/mod/data/backuplib.php @@ -1,9 +1,8 @@ id) @@ -31,7 +30,7 @@ // //----------------------------------------------------------- - //Backup assignment files because we've selected to backup user info + //Backup data files because we've selected to backup user info //and files are user info's level @@ -66,7 +65,7 @@ function data_backup_one_mod($bf,$preferences,$data) { fwrite ($bf,start_tag("MOD",3,true)); - //Print assignment data + //Print data data fwrite ($bf,full_tag("ID",4,false,$data->id)); fwrite ($bf,full_tag("MODTYPE",4,false,"data")); fwrite ($bf,full_tag("NAME",4,false,$data->name)); @@ -103,14 +102,13 @@ function data_backup_one_mod($bf,$preferences,$data) { $status = backup_data_records($bf,$preferences,$data->id); $status = backup_data_fields($bf,$preferences,$data->id); if ($status) { - $status = backup_data_files_instance($bf,$preferences,$assignment->id); //recursive copy + $status = backup_data_files_instance($bf,$preferences,$data->id); //recursive copy } } fwrite ($bf,end_tag("MOD",3,true)); return $status; } - //Backup assignment_submissions contents (executed from assignment_backup_mods) function backup_data_fields($bf,$preferences,$dataid){ @@ -252,7 +250,7 @@ function backup_data_files_instance($bf,$preferences,$instanceid) { //in temp/backup/$backup_code dir $status = check_and_create_moddata_dir($preferences->backup_unique_code); $status = check_dir_exists($CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/data/",true); - //Now copy the assignment dir + //Now copy the data dir if ($status) { //Only if it exists !! Thanks to Daniel Miksik. if (is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/data/".$instanceid)) { @@ -309,7 +307,7 @@ function backup_data_files($bf,$preferences) { //First we check to moddata exists and create it as necessary //in temp/backup/$backup_code dir $status = check_and_create_moddata_dir($preferences->backup_unique_code); - //Now copy the assignment dir + //Now copy the data dir if ($status) { //Only if it exists !! Thanks to Daniel Miksik. if (is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/data")) { @@ -330,7 +328,7 @@ function backup_data_file_instance($bf,$preferences,$instanceid) { //in temp/backup/$backup_code dir $status = check_and_create_moddata_dir($preferences->backup_unique_code); $status = check_dir_exists($CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/data/",true); - //Now copy the assignment dir + //Now copy the data dir if ($status) { //Only if it exists !! Thanks to Daniel Miksik. if (is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/data/".$instanceid)) { diff --git a/mod/data/restorelib.php b/mod/data/restorelib.php index afe5f5453c..4251ad04e2 100644 --- a/mod/data/restorelib.php +++ b/mod/data/restorelib.php @@ -1,8 +1,7 @@ id) @@ -30,7 +29,7 @@ // //----------------------------------------------------------- - //Backup assignment files because we've selected to backup user info + //Backup data files because we've selected to backup user info //and files are user info's level $fieldids = array(); //array in the format of $fieldids[$oldid]=$newid. This is needed because of double dependencies of multiple tables. @@ -82,7 +81,7 @@ function data_restore_mods($mod,$restore) { //Do some output if (!defined('RESTORE_SILENTLY')) { - echo "
  • ".get_string("modulename","data")." \"".format_string(stripslashes($assignment->name),true)."\"
  • "; + echo "
  • ".get_string("modulename","data")." \"".format_string(stripslashes($database->name),true)."\"
  • "; } if ($newid) { @@ -279,7 +278,7 @@ function data_restore_files ($old_data_id, $new_data_id, $old_field_id, $new_fie //Check it exists and create it $status = check_dir_exists($moddata_path,true); - //Now, locate assignment directory + //Now, locate data directory if ($status) { $data_path = $moddata_path."/data"; //Check it exists and create it @@ -293,9 +292,9 @@ function data_restore_files ($old_data_id, $new_data_id, $old_field_id, $new_fie $todo = check_dir_exists($temp_path); } - //If todo, we create the neccesary dirs in course moddata/assignment + //If todo, we create the neccesary dirs in course moddata/data if ($status and $todo) { - //First this assignment id + //First this data id $this_data_path = $data_path."/".$new_data_id; $status = check_dir_exists($this_data_path,true); @@ -304,7 +303,7 @@ function data_restore_files ($old_data_id, $new_data_id, $old_field_id, $new_fie $status = check_dir_exists($this_field_path,true); $this_record_path = $this_field_path = $this_field_path."/".$new_record_id; $status = check_dir_exists($this_record_path,true); - //And now, copy temp_path to user_assignment_path + //And now, copy temp_path to user_data_path $status = @backup_copy_file($temp_path, $this_record_path); } -- 2.39.5