Moodle Plugins directory: Legacy files migration | Moodle.org
Legacy files migration
Legacyfiles migration admin tool for moodle 2.4 and above
Goal
This plugin is designed in order to migrate legacy course files to private files area for a choosen user
Author
Written for Université de Strasbourg(unistra.fr) by Celine Perves cperves@unsitra.fr  
Inspired from "Nicolas Can" script see https://moodle.org/mod/forum/discuss.php?d=210415  
Installation
Install the whole folder into admin/tool folder  
Use
Navigation
Under root navigation will appear a new admin category name legacyfiles migration  
this has 2 submenu :  
* Legacy files migration settings : for chaning folder name  
* Legacy files migration with the tool  
Migration
Legacy files migration will show a list of courses to migrate  
foreach of these you have to choose an editingteacher (if availabe) or fill a username  
The legacy files will be migrated into user selected private repository  
Test
For test use you can automaticaly select first user of owner lists and fill username with a username  
Features
migrate all legacy files into user private file areas  
change module resource references to files to the migrated files in user private area  
in case of folder referenced by a module resource, all the files and subfolders entries will automatically be created as module resource (in legacy files mode these were created at first consultation  
Licence
 http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later  
 http://www.cecill.info/licences/Licence_CeCILL_V2-en.html  
 
 Feel free to complete and improve this plugin  
 do not hesitate to fork and pull request  
I corrected all the issue you noticed to me and push them in reorganised git repository.
There is one thing I encountered when testing the functionality of your plugin - and I am not sure it is expected behaviour. The name, the description and the UI of your plugin suggests that it's only legacy files that would be migrated/moved to the selected user's private files. But then I realized that also other files - most notably those embedded as the File activity (mod_resource) were migrated into the private area too - even if they were not legacy files. I can see the code in your locallib.php doing this but it's not clear to me why it should do that. Files embedded into the mod_resource are definitely safer in backup/restore operations. You turn them into symlinks/aliases of private files. That sounds like a step backwards to me. But I may miss something.
I am marking this as needing more work to get these issues sorted out. Thanks for your patience with the review process.
I realise thanks to your comment that I don't check if mod_resource is linked to legacyfile or other filearea. and so migrate all files.
I'm gonnat try to filter mod_resources
Thank you