$status = data_content_restore_mods ($oldid, $newid, $old_data_id, $new_data_id, $rec_info, $restore);
$status = data_ratings_restore_mods ($oldid, $newid, $info, $rec_info);
- $status = data_comments_restore_mods ($oldid, $newid, $info, $rec_info);
+ //$status = data_comments_restore_mods ($oldid, $newid, $info, $rec_info);
} else {
$status = false;
if ($status) {
$temp_path = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code.
"/moddata/data/".$old_data_id."/".$old_field_id."/".$old_record_id;
- $todo = check_dir_exists($temp_path,true);
+ $todo = check_dir_exists($temp_path);
}
//If todo, we create the neccesary dirs in course moddata/assignment
$ratings= $rec_info['#']['RATINGS']['0']['#']['RATING'];
+ if (empty($ratings)) { // no ratings to restore
+ return true;
+ }
for ($i = 0; $i < sizeof($ratings); $i++) {
$rat_info = $ratings[$i];
$rating -> rating = backup_todb($rat_info['#']['RATING']['0']['#']);
$status = insert_record ("data_ratings",$rating);
-
}
return $status;
}
$comments= $rec_info['#']['COMMENTS']['0']['#']['COMMENT'];
+ if (empty($comments)) { // no comments to restore
+ return true;
+ }
+
for ($i = 0; $i < sizeof($comments); $i++) {
$com_info = $comments[$i];