Converting a backup thas has Legacy to a backup that has No Legacy

Converting a backup thas has Legacy to a backup that has No Legacy

by Ken Task -
Number of replies: 0
Picture of Particularly helpful Moodlers

Before I started down a rabbit hole thought I'd ask if anyone has solved this - legacy files in backup ... means legacy forever.  (I know there is an addon called 'Poof' (?) that will change each item when editing but that would mean editing many many links/resources.   Am looking for a 'faster' way.

Attempting to resolve the issue of legacy files ....

Am looking at file.xml of two extracted backups of Moodle courses not from the same server and not of the same version of Moodle but in the 2 series - 2.9.x

In the files.xml file of the extracted backup of a *no legacy* course there are these tags:

<component>mod_resource</component>
<filearea>content</filearea>

In the files.xml file of the extracted backup of a *legacy course*, there are these tags:

<component>course</component>
<filearea>legacy</filearea>

Context ID is different

In no legacy each file resource has a unique context ID
<contextid>52823</contextid>

In a legacy each file resource has the same context ID
<contextid>181273</contextid>

If, I were to edit the files.xml file of a legacy course and change
the component from 'course' to 'mod_resource'
the filearea from 'legacy' to 'content'
and
the 'contextid' increment each by one ... starting at 52823 as an example
and making the next reference 52824

Then re-tar-gz the extracted backup making sure moodle_backup.xml file is at the
root of the un-tarred/gzipped archive, would the course restore
**without legacy files**?

OR, better yet ... does anyone have a script one could run locally, to fix the legacy issue?

'spirit of sharing', Ken


Average of ratings: -