Restore doesn't like my zip files

Restore doesn't like my zip files

David Scotson發表於
Number of replies: 4

I've tried to anonymize some course content by unzipping a backup, search and replacing through moodle.xml, and then zipping again.

This fails at the first hurdle with the message:

Error checking backup file. Invalid or corrupted.

In investigating this it turns out that simply unzipping and zipping the file (on either Windows XP or Mac OS X) is enough to stop the Moodle restore process from functioning.

I turned on debug but didn't get any more info.

Seaching the forum suggested that using the built in php zip routines might cause problems, switching them to use the ones supplied with Linux didn't seem to help.

Does anyone have any helpful suggestions?

評比平均分數: -
In reply to David Scotson

Re: Restore doesn't like my zip files

David Scotson發表於

Looking at the code, all it appears to be doing is reading the first 200 characters and checking that the file starts with:

<?xml version="1.0" encoding="UTF-8"?>

and contains:

<MOODLE_BACKUP>

which

  • I'm fairly certain my moodle.xml file does, and
  • I'm not sure why simply unzipping and rezipping a file should change this test from true to false

Pretty much stumped now 傷心

In reply to David Scotson

Re: Restore doesn't like my zip files

David Scotson發表於

Okay, figured it out.

When I unzipped the backup, a containing folder was magically created for me, when I rezipped this folder was included within the zip file. This meant that when Moodle unzipped it for restoring it was looking in the wrong place for the moodle.xml file.

I think that's what's happening anyway. I will file a bug as this should probably be catered for and not finding the file at all should probably give a different error from finding a file that doesn't suit the expected naming and structure.

In reply to David Scotson

Re: Restore doesn't like my zip files

Eloy Lafuente (stronk7)發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片 Testers的相片
Confirmed.

The backup.zip files must contain, in their first level, the moodle.xml file so, if you are going to zip a backup file back you must select all the files at the same level than moodle.xml and create one zip file with them, but without the "container" folder that your unzip utility creates when decompressing.

Thanks for filling Bug 5334. I'll try to difference between errors to make things a bit clearer...ciao 微笑
In reply to David Scotson

Re: Restore doesn't like my zip files

Stephan Becker發表於
Hello there,

I am not sure if I have the same problem with backing up?

I am trying to move a course backup between 2 different Moodle installations: I backed up my course on www.academy.beautifuloceans.com, downloaded the zip file to my desktop - and then uploaded this backup file vis FTP into the backupdata folder of a different Moodle installation (currently www.beautifuloceans.com/carib) "

Is this actually something I can do? Will the links be reconfigured automatically to take into account the new location www.beautifuloceans.com/carib? Currently, when trying to restore the course from the backup file uploaded via FTP, I get a message error : "Error checking backup file. Invalid or corrupted."

Thank you,
Stephan