Moodle

Copying course files twice at course backup operation

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.5
  • Fix Version/s: None
  • Component/s: Backup
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

Some of the course files are copied at first when these files or folders are directed by mod/resource.Then, their are copied at the phase of copying the course files again.

I think that the target course file does not need to copy if they had been already copied,

backup/lib.php, function backup_copy_file(),

function backup_copy_file ($from_file,$to_file,$log_clam=false) {

global $CFG;

if (is_file($from_file)) {
//echo "<br />Copying ".$from_file." to ".$to_file; //Debug
//$perms=fileperms($from_file);
//return copy($from_file,$to_file) && chmod($to_file,$perms);
umask(0000);
// if (copy($from_file,$to_file)) { // original
if (file_exists($to_file) or copy($from_file,$to_file)) { // here!!, adding check
chmod($to_file,$CFG->directorypermissions);
if (!empty($log_clam)) { clam_log_upload($to_file,null,true); }
return true;
}
return false;
}

Activity

Hide
Tatsuya Shirai added a comment -

The duplicated copy occurs when resource/folder is used in the course.

Show
Tatsuya Shirai added a comment - The duplicated copy occurs when resource/folder is used in the course.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: