Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/course/lib.php b/course/lib.php
- index d0ad4f0660..a475fbd30b 100644
- --- a/course/lib.php
- +++ b/course/lib.php
- @@ -3452,6 +3452,14 @@ function duplicate_module($course, $cm) {
- $bc->destroy();
- + // Hack the backup, we want a different name here.
- + $filetohack = $backupbasepath . '/activities/' . $cm->modname . '_' . $cm->id . '/' . $cm->modname . '.xml';
- + // Activity xml files are small enough to be read as a whole.
- + $filecontents = file_get_contents($filetohack);
- + // Of course we must support here lang strings and copy 2, 3, 4...
- + $filecontents = preg_replace('#(<name>)(.*)(</name>)#', '${1}I hacked ${2}!!${3}', $filecontents);
- + file_put_contents($filetohack, $filecontents);
- +
- // Restore the backup immediately.
- $rc = new restore_controller($backupid, $course->id,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement