Can't restore courses - Moodle 2.7.2+

Can't restore courses - Moodle 2.7.2+

by Mike Brinkman -
Number of replies: 6

I downloaded & installed a stand-alone version of Moodle 2.7.2+ for Windows on my computer. 

I have backed up a course in the usual manner on our production site (Moodle 2.7.1) and attempted to restore it on the stand-alone installation, and it never finishes the uploading process. I see the status bar completed, but it never switches over to a URL. I even let it go over my lunch hour, so it's not a matter of time. If I click on the restore button after uploading the file via drag & drop, I get the following error:

error/invalidrestorefile

More information about this error 

I've also tried using the file picker instead of drag & drop, and all I get is the spinning timer after selecting the file. What can cause this to happen?

On a side note, I am able to upload plugins and install them, so it seems that only the restore functionality is broken.

Average of ratings: -
In reply to Mike Brinkman

Re: Can't restore courses - Moodle 2.7.2+

by Colin Fraser -
Picture of Documentation writers Picture of Testers

There may be several explanations for this behaviour, but the most immediately obvious one is the backup file has been corrupted, that is the xml file has possibly been damaged in some way. In the v2.7.2+ create a backup file. Download it, chence the file extension from mbz to zip, unzip it. Do the same to the v2.7.1 backup file and look at the xml file of both backups. is there any weirdness in either one?  Look at the file structure of both backups, are they similar, or very different? They should be similar, if not the same despite being different courses. If the xml file has been damaged, it may not be unzipping the file properly, hence the spinning wheel. 

Another possibility is that the downloaded v2.7.1 file has been damaged during the download process, (which has been known to happen but not to my knowledge for a long time), or the installation was not quite as smooth as possible, and something was not properly copied, or installed during the install process. Downloading the latest version and replacing the standalone usually fixes anything resembling that. Another way to fix these things might be to replace just the file handling/upload/d'n'd and backup/restore sub-folders in the Moodle code. 

Sorry about the shotgun approach here, but these things all fix different problems, and from the information given, it is not really easy to determine what the actual problem is. Try one thing, then the next, then the third and so on. Good luck.   

Average of ratings: Useful (1)
In reply to Colin Fraser

Re: Can't restore courses - Moodle 2.7.2+

by Mike Brinkman -

I downloaded a new copy of XAMPP and installed Moodle using Bitnami. The version they had available was 2.7.2, so I'm back to that. Given that

  • I am able to restore Moodle 2.5.1 backups to the Moodle 2.7.2 local host without issue, but not 2.7.1 backups.
  • I am able to restore 2.7.1 backup file that won't load into Moodle 2.7.2 to my 2.7.1 production site without any issue.

The only conclusion I can come to is that Moodle 2.7.2 doesn't like Moodle 2.7.1 backups. Sounds ludicrous, but I can't think of any other explanation.

In reply to Mike Brinkman

Re: Can't restore courses - Moodle 2.7.2+

by Ken Task -
Picture of Particularly helpful Moodlers

I might be wrong (not a programmer) but inspecting the file reported in the error
and the line number, in a freshly acquired moodle27 via git,

That line includes something that appears to be commented out!!!????

if ($stage < $currentstage && $currentstage < restore_ui::STAGE_COMPLETE) {
      //$item['link'] = new moodle_url($PAGE->url, array('restore'=>$this->get_restoreid(), 'stage'=>$st$
}

What's enclosed between ( and ) appears to be commented out - the // in front of that line.

Wonder what would happen if those comments are removed in that file?

'spirit of thinkering', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Can't restore courses - Moodle 2.7.2+

by Mike Brinkman -

I uncommented line 158, and tried with a Moodle 2.5.1 file just for the fun of it. It stalls out during the restore process without any errors. I like to tinker too, so I appreciate the suggestion. smile

In reply to Mike Brinkman

Re: Can't restore courses - Moodle 2.7.2+

by Ken Task -
Picture of Particularly helpful Moodlers

Well, sorry to hear that!   More sluething ...

Moodle uses the moodledata/temp/backup/ directory for backups and restores.   Success backups/restores leave a 0 byte .log file.  Unsuccessful backups/restores leave a larger than 0 byte .log file - and a contenthash named directory.   Inspect the .log file for a clue.   Might look into that contenthash named directory for a moodle_backup.xml file - that's the roadmap to the course contents and is used in both backups and restores.    If something exist in the .xml file but one cannot find the corresponding item in the rest of the folders/files, there's your culprit.   Now what to do about it ... ????

'spirit of thinkering', Ken

In reply to Ken Task

Re: Can't restore courses - Moodle 2.7.2+

by Philip Roy -

We've just had the same issue here...it seems to be something to do with the standalone Windows install of Moodle.

Here's our situation...

* A hosted version of Moodle 2.5 which we are moving away from

* We've backed up and downloaded courses to a PC

* On my colleagues PC, we installed a standalone version of Moodle 2.8.5

* Every time we try to upload a backup into the standalone version, it stalls during the upload process

* We can take the backup and restore it into 2 separate hosted versions of Moodle 2.8.5 with no upload problems at all

* To make sure it was the standalone version that was causing issue, I also installed the standalone version, and I cannot upload any of the backups to restore them

Hope that helps? Am I missing something I am meant to do on the PC? (Note - I'm a Mac user mostly, so not sure what else I should do on Windows 7)

Phil