Backup code issue Moodle 2.9.1

Backup code issue Moodle 2.9.1

by David Belenguer -
Number of replies: 0

Hello,

I've got an issue on an own Moodle plugin, it receives two courses, backup the first one and restores it in the other one. The problem is that it doesn't work on Moodle 2.9.1. The backup finishes correctly but when i want to extract it to for example '/backup/de6660560e757bdd358f44a60850d1ea' it fails.  I supose that the format has changed, but I haven't been able to change it correctly. Can anybody show me how to do it well?


$file->copy_content_to($CFG->tempdir . '/backup/' . $bc->get_backupid() . '.zip');
$file->delete();
$file = $CFG->tempdir . '/backup/' . $bc->get_backupid() . '.zip';
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
   // extract it to the path we determined above
   $zip->extractTo($CFG->tempdir . '/backup/' . $bc->get_backupid() . '/');
   $zip->close();
}

Average of ratings: -