General developer forum

Transform all legacy files to private files or other repository

Picture of Céline Perves
Transform all legacy files to private files or other repository


I would like to know if there is a script to migrate al legacy files to an other repository?

Thank you


Average of ratings: -
Picture of Ken Task
Re: Transform all legacy files to private files or other repository
Particularly helpful Moodlers

That would be a very nice feature ... but, don't think it exist and might be extremly difficult to program due to nature of new file system.  Besides it would be only for migration of 1.9's to 2's as Legacy will eventually go away (I hope!).

Still have a copy of your old 1.9.x data folder?

One *could*:

Clean up the un-used 1.9 data directory ... removing the 1 folder (was backup for front page), and removing any backupdata folder (and contents) in any other course ID folders - 1.9 backups just take up room in the new file system.   Also remove any course ID number moddata (folder/contents).

What one ends up with are the files/images that were uploaded to the 1.9 courses.

Once those are cleaned up ... tar ball or zip (recursively) them all while in the moodledata folder  - the archive will then unzip/un-compress to folders by course ID numbers.

Make some notes on what course ID was used for what course.  You'll need that info when creating a file system repo for a course.

Now the 2 side of things ...

turn on file repo in the 2.x ... that should create a repository directory in the data folder for the 2.x

Then, create a repo for the 1.9 course ID folders.  Can all it anything you like: oldfiles.   'oldfiles' folder is a manually created directory in the repository directory of the 2.  It has permissions/owerships set for the apache user and group.

For courses that have Legacy and one is attempting to get away from that, create a file system repo that points to their old course ID folder.

Now the files are there ... this won't, however, magically turn legacy linked files into new file system links.  That has to be done manually.  For some courses that might be a lot of work.  However, once all the links have been created, one could turn off Legacy in that course.

This will make the 2 site even larger ... for a time.

For testing ... setup just one repo (such as described for a 2 course) after one gets a Legacy course re-linked and Legacy turned off in that course, run a backup in the 2 and restore it.  Legacy gone?

Like I said ... could be a lot of work depending upon size of the Moodle implementation - not a 'one size fits all' solution, but doable!

'spirit of sharing', Ken

Average of ratings: -
Picture of Céline Perves
Re: Transform all legacy files to private files or other repository

seems to be difficult to develop but since I need to migrate also a 1.9 resource module that was emulate a kind of repository, I realise that It would be usefull to develop it for legacy course files also. Teachers will then take good habits with the new moodle repository system.

If some one has deep developping informations on repository and file process in Moodle 2.x it would be possible for me to develop that kind of tool

Average of ratings: -