Project

General

Profile

Bug #3059

Course copy misses files when directory not registered

Added by Yannick Warnier over 8 years ago. Updated over 8 years ago.

Status:
Bug resolved
Priority:
Normal
Category:
-
Target version:
Start date:
08/03/2011
Due date:
08/03/2011
% Done:

100%

Estimated time:
1.00 h
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
5

Description

In main/coursecopy/classes/CourseRestorer.class.php, function restore_documents(), when a file is part of a directory for which the entry cannot be found in the database (for example PDF/abc.pdf can be found in the documents table but PDF/ is not there as a directory), the directory in the destination course is not created, hence no file can be copied in it.

This is generating loss of contents on copy and should be avoided, probably adding a recursive check for the directory's existence. The easiest way to do that would probably to add a "$recursive=false" parameter to main/inc/lib/fileUpload.lib.php's create_unexisting_directory(), which would trigger a recursive mode when set to true. This function is the one called from CourseRestorer.class.php.

History

#1

Updated by Yannick Warnier over 8 years ago

Obviously, the initial missing directory should be considered as corrupt data, but if that happens, we shouldn't corrupt the data even more...

#2

Updated by Yannick Warnier over 8 years ago

Apparently create_unexisting_directory() is already recursive, so the only change required is in fact to call the function from restore_documents().

#3

Updated by Yannick Warnier over 8 years ago

  • Due date set to 08/03/2011
  • Status changed from New to Bug resolved
  • Assignee set to Yannick Warnier
  • Start date changed from 09/03/2011 to 08/03/2011
  • % Done changed from 0 to 100
  • SCRUM pts - complexity changed from ? to 5

Also available in: Atom PDF