Bug #3059
closedCourse copy misses files when directory not registered
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.
Updated by Yannick Warnier almost 12 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...
Updated by Yannick Warnier almost 12 years ago
Apparently create_unexisting_directory() is already recursive, so the only change required is in fact to call the function from restore_documents().
Updated by Yannick Warnier almost 12 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