Restore fails

Restore fails

by Bill Stone -
Number of replies: 14
Hi,

Using 2.7.3+ Build 20141112

Our instructors report and we confirm they encounter an error when attempting to restore an .mbz file into a class. This occurs with a range of different .mbz files from different sources: from one instructor to the same instructor, from one instructor to another instructor, from a publisher to an instructor, etc.

For example, I go to an instructor's class B, make a backup file, and download it. Then I go to another instructor's class A and attempt to restore the .mbz file from class B into class A. The file uploads, but generates error message as shown below.

This problem apparently -- can't confirm for sure -- appeared when we upgraded from version 2.6 to version 2.7. This does not appear to be related to excessive file size or timing out due to lengthy processing, although at this point I suppose anything is possible.

Thanks for any suggestions anyone can provide.

Diagnostics from failed restores:

error/invalidrestorefile

More information about this error

Debug info:
Error code: invalidrestorefile
$a contents:

Stack trace:
line 225 of /backup/util/ui/restore_ui_stage.class.php: restore_ui_exception thrown
line 80 of /backup/restore.php: call to restore_ui_stage_confirm->process()
Average of ratings: -
In reply to Bill Stone

Re: Restore fails

by Bill Stone -
We resolved this issue.

Thanks.
In reply to Bill Stone

Re: Restore fails

by Ken Task -
Picture of Particularly helpful Moodlers

Glad you did, but for the benefit of future posters to the original posting who might find  it and say 'me too' and for the rest of the community who are just curious, what was the resolution to the issue? ;)

'spirit of sharing', Ken

In reply to Ken Task

Re: Restore fails

by Bill Stone -
During upgrade to 2.7, sys ad inadvertently changed config for temp directory, thus uploaded .mbz files for restore were going to unsuitable location on the cluster.
In reply to Bill Stone

Odp: Re: Restore fails

by Andrzej Tokarski -

Hi, I have the same problem with moodle 2.7 from very beginning. Every time I try to restore the course - the following info appears: "Thrown by backup/util/ui/restore_ui_stage.class.php:157

The requested file does not exist in temp/backup."

 It seems that it is the problem of moodle 2.7 but not the case of upgrading from 2.6 to 2.7.  

Can you explain more directly how you solved the problem and which config needs changing and in what way. 

I would be grateful if you could tell me which part of the code needs changing and to which version of the code. 


In reply to Andrzej Tokarski

Re: Odp: Re: Restore fails

by Ken Task -
Picture of Particularly helpful Moodlers

Don't think Bill did any hacking/correcting of code, but, from his response, corrected either paths or locations of moodledata/filedir in his cluster setup.    Do you have a cluster setup?

You've also said "with moodle 2.7 from very beginning"

Is this the complete error you see? "The requested file does not exist in temp/backup" or does it show your moodledata/temp/backup/ then some long filename like:

11b7c96522e8ca079a2f27e843bcea5f

That particular line in a 2.7.15 (Build: 20160711) is the following.

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

I've just tested a restore on the build you see above and no such errors.

Check your moodledata directory ... temp/backup/ to see if there is a larger than 0 byte .log file by a long name like:

6363ad4f8c8ab0b14014c95e00fabd37.log

Those are asciii (text and can be viewed).    If there is anything in there it might be a clue as to what happened.

'spirit of sharing', Ken

In reply to Ken Task

Odp: Re: Odp: Re: Restore fails

by Andrzej Tokarski -

Hi, Thanks for your quick response.

My moodle version is:  Moodle 2.7+ (Build: 20140529)

I am an English teacher and I am trying to apply moodle for my school.

I make testing courses in my  moodle xamp server on my PC (Windows 7 platform),

then I try to export them to my own testing server on another PC (also under (windows 7) working 24 hours a day and available through www.

I have no cluster setup, but I was able to transfer the whole moodle from my PC to my www server - changing only the path in moodle/ php /config. But there is no sense to transfer the whole moodle after every changing on my PC.

So I made a few bacup.mbz copies of my courses, then dowloaded them outside moodle to my PC.  Yet, they are impossible to restore to moodle both in my PC and exactly the same on my www server.

However,  I am able to restore courses picking up bacup files from my moodle server, but not from PC.
This is not enough for me, because I am not able to transfer courses to another moodle. Many moodle users say it should be possible.

After trying to restore from PC the file is unpacked, but after clicking "restore" - the following comment appears : error/invalidrestorefile,

after clicking more information about this error the following info on moodle.org is: Thrown by backup/util/ui/restore_ui_stage.class.php:157. The requested file does not exist in temp/backup.


There were some empty files named such as 11b7c96522e8ca079a2f27e843bcea5f in my  moodledata/temp/backup/,

but even after deleting them all - nothing changed.

I have also tried moodle 3.1.1 stable, but although there are not any error comments, the outside mbz backup files are being unpacked, then the comment is given that the bacup file is needed* - so external backup.mbz files are not accepted. 

A few people in Poland has exactly the same problem.

Maybe this is the problem of Windows platform?

Could you tell me please the direct path to the file with the code you sent me?

Thanks again for your response.

Best Wishes, Andrew



 


In reply to Andrzej Tokarski

Re: Odp: Re: Odp: Re: Restore fails

by Ken Task -
Picture of Particularly helpful Moodlers

First and foremost ... it's never a good idea to hack/change core code unless you know what you are doing.  Suggest that, from your description, that the only reason in knowing location of the file is to look at it ... ie, your curious - which is OK, just don't change.

It tells you in the error:
moodlecode/backup/util/ui/restore_ui_stage.class.php   Line 157

The ONLY reason I shared that with you was for you to look to see if that line looked like the one I have on my server - which doesn't have any such issue.


Rather than beginning what could be a very lengthy discussion, let's just cut to the chase:

Turn on debugging
Site Admin menu -> Development -> Deugging
Set debug messages to Developer
Save changes

then try your restore process again.   Are you dragging and dropping the .mbz file?  or are you using other process to upload the .mbz file?

The output will display on your screen with, hopefully, more information.
Copy that info to NotePad.   Come back to this forum, and respond pasting
the info from NotePad.

'spirit of sharing', Ken


In reply to Ken Task

Odp: Re: Odp: Re: Odp: Re: Restore fails

by Andrzej Tokarski -

Hi,

The only one case I was changing php file was changing the path to my moodledata on my www server.
Before doing that I was advised on a few forums what to do and how - so I knew what I was doing and it was successful.

I don't think it is a bad idea to open the file to see what sth. looks like if needed. Even if I think I know what I am doing I always have the copy of the file before changing anything, and the copy of the whole system in case I am "lost in translation".

I am almost certain the problem is that the files being restored are being send to the wrong folder or have php restrictions to check the wrong folder, but the case is not in line 157 which seems to be correct (at least is the same as yours).

 I didn't change any core in my system except for mentioned above.
If the system itself is correct everything should be OK even with my limited php knowledge, but it isn't. Of course no offense.

Sorry to trouble you my friend, it seems to me that even if there is the solution, it would be too long to explain.
Below I insert info you asked for...always good to know what it looks like, just in case.
Nevertheless, don't bother. I am not going to waste your time for long explanations. I wil manage this way or another.
Just thought it was simple to solve if you know how.

Answers to your questions:

I tried both methods of uploading backup.mbz files
(before that I watched video tutorials how to do it)
but in my moodle neither of uploading methods was successful.
Using picking up file method - the system started thinking and thinking...
unsuccessfully  trying to upload the file but nothing happened.
Using dropping method - the file was uploaded and unpacked - but after clicking "Restore" - there was an error.


Here is the info after debugging: (but the restoring process failed as before)

error/invalidrestorefile

More information about this error

Debug info: 

Error code: invalidrestorefile 

$a contents:

Stack trace:

line 225 of \backup\util\ui\restore_ui_stage.class.php: restore_ui_exception thrown

line 80 of \backup\restore.php: call to restore_ui_stage_confirm->process()


And at last - the part of the code according to
 moodlecode/backup/util/ui/restore_ui_stage.class.php   Line 157:


155     }        

156     $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'),'class' => join(' ', $classes));       

157    if ($stage < $currentstage && $currentstage < restore_ui::STAGE_COMPLETE)            {          

158           //$item['link'] = new moodle_url($PAGE->url, array('restore'=>$this->get_restoreid(), 'stage'=>$stage));      

159     }


As you see, line 157 is exactly the same as yours.


Thank you so much for your time and effort.
I learned so much from you, but again I am not going to waste your time.

Best regards, Andrew.




In reply to Andrzej Tokarski

Re: Odp: Re: Odp: Re: Odp: Re: Restore fails

by Ken Task -
Picture of Particularly helpful Moodlers

error/invalidrestorefile

indicates your www box doesn't recognize what you've uploaded or linked to or pointed to as a valid backup .mbz file.

Due to:

"in my moodle neither of uploading methods was successful"   meaning drag and drop of the .mbz file failed as well as choose file and upload failed.   Thus Moodle cannot reach the first stage of the restore process which is:

Stage 1 is confirm ... shows the backup details.   Shows the backup files settings.   That would make sense ... no file uncompressed in moodledata/temp/backup/ Moodle can not read the moodle_backup.xml file used as a roadmap for content contained in the .mbz file.

But then you mention "Using picking up file method".    Seem to re-call reading something about that but don't re-call the details only that the course had to already reside in the Moodle.

Just what does "Using picking up file method" means?  URL downloader?

Here's the "long winded stuff" I was going to share earlier ... about the stages of the restore process.

Stage 2 - is Destination ... restore to new course and pick category.
OR restore to this course if you started the restore process from within
a course.  OR Restoring into an existing course.

Stage 3 - Restore settings

Stage 4 - Schema ... where you can change the course name, short name and set course date.

Stage 5 - Review
Perform button appears here.

Stage 6 - Process

Stage 7 - Complete

Can you upload other types of files?   Like PDF's or Images or Word Docs or Videos/audios?

Something is definitely wrong ... one should be able to upload .mbz's by drag and drop or by choose file method.

'spirit of sharing', Ken


In reply to Ken Task

Odp: Re: Odp: Re: Odp: Re: Odp: Re: Restore fails

by Andrzej Tokarski -

Hi,

Both restoring methods I mentioned before are:

- drag and drop

- choose file and upload ( picking up file method) - but not  through URL

both failed.


There is no problem with restoring "no-moodle files" such as PDFs, all kinds of audios and videos, .txt .doc and so on,
just drag and drop or choose file and upload - works as supposed to.


The problem is to restore all "moodle documents" such as
book, file, forum, lesson and all the others, 
created by using " Add an activity or resource" tool within moodle.

I know all the stages needed while backing up and restoring the course, 
because i successfully backed up and restored courses within moodle,
changing names categories and so on.

Generally I know how to use moodle.  
I studied many tutorials and practiced everything on my own.
Of course I still have to practice and do not consider myself a great expert.

Everything works excellent, except restoring courses from backup.mbz from out of moodle. I also tried to restore in my moodle the course which I got as  free mbz from the net. The result was the same, so it seems to be not the case of my backing up.

 
My Moodle stops restoring external backup.mbz on stage one (never mind if this is only "book"  file for example or sth more complex - and that's the end.

So something is definitely wrong.

As I told you before I have also tried moodle 3.1.1 lately. There are no errors shown (with no debugging), but restoring stops at stage 1 (exactly the same as in moodle 2.7).  It is quite impossible for all the versions higher than 2.6 to have my restoring problem.  So the problem seems to be in xampp for windows package and its default settings while working with Windows 7.

I am going to try to install moodle 3.1.1 on Ubuntu, (under virtual Windows 7) just to see if the problem also exists there.
It will take some time. Later I will also try Windows XP.

Which platform do you have your moodle installed on?

I will let you know when/if get some ideas.

Regards, Andrew


In reply to Andrzej Tokarski

Re: Odp: Re: Odp: Re: Odp: Re: Odp: Re: Restore fails

by Ken Task -
Picture of Particularly helpful Moodlers

Mybe the resident Windows expert (Osman) will grace us with his involvement here.  

So, just to make sure any others that read this thread also understand ... you can upload PDF's, Word Docs, whatever into a course using the normal add a resource, etc.    It's just backups you cannot restore by any method - .mbz files.

About version 2.6 Moodle changed from zip archiving to what it called experimental at the time (Gzipped and Tarred) format.   The .mbz file could still be a zip or it could be the new now default gunzipped/tarred type file.

So on your PC, make a backup .mbz file and download it to your Windows 7 desktop in a test directory/folder.   Then change the extension (the .mbz) to .zip.   See if you can un-zip it.   If you can't, then the file is a gunzipped file.   Change extension back to .mbz and get software installed that will un-compress a gunzipped file.

In order for Moodle to work properly, there must be PHP extensions loaded on whatever you are using as a server.  The two dealing with zips ... php-zip and php-zlib.

All Moodles (for as long as I can remember) have in site admin menu, a server menu item and under that PHPInfo.

In the display of php info, one should see a zip.ini in additional .ini files parsed, a Bz2 section, zip, and zlib.

Will make this comment, didn't think Windows 7 was meant for server anything.

https://www.google.com/search?q=Windows+7+as+server&ie=utf-8&oe=utf-8

Some folks do it but think none stick with that XAMPP package ... and eventually install things like true IIS etc. as well as move to a true server OS ... maybe even Linux.

So ... CALLING ANY WINDOWS PERSON ... you're up! ;)

'spirit of sharing', Ken


In reply to Ken Task

Odp: Re: Odp: Re: Odp: Re: Odp: Re: Odp: Re: Restore fails

by Andrzej Tokarski -

That's right:

 I can upload PDF's, Word Docs, whatever into a course using the normal add a resource, etc.   
 It's just backups I cannot restore by any method - .mbz files.

My Windows 7 is able to unzip both zip and mbz files. (using 7-zip software)

When I drag and drop mbz into moodle it is being unpacked but stage 1 is the end of restoring. Then only error info.

My moodle has php-zip and php-zlib extentions (shown in PHP info).

I am afraid I have to end my topic here, because I have to restore my school from September and have a lot of work to do.

Thanks for help. Let you know when/if find some kind of solutions.

Regards, Andrew.



In reply to Ken Task

Problem solved

by Andrzej Tokarski -

Hi, Happy to inform you, that I solved the problem of restoring  my courses from backup.mbz.

The problem was in the size of the file to be restored.
(the same problem exisetd in Windows XP)

My course backups were small, because experimental only. 
The size was no more than 30 MB. But my moodle, hosted in windows under localhost,
allowed only 8 MB of upload, that was the max  file size which
I was able to set within moodle. 

To solve the problem I had to change the settings in php.ini.

post_max_size was 8MB ,    I changed to 100

and

 upload_max_filesize was 32MB ,      I changed to 100

Still,  of course, I am able to limit for my students the size of uploaded files within moodle .

I can successfully restore all my courses now. smile

Thank you very much for clues and your time. 

Share this info with moodle community.

All the best. Andrew




In reply to Andrzej Tokarski

Re: Problem solved

by Ken Task -
Picture of Particularly helpful Moodlers

Congrats!   Yes, known issue and a tweakie setting but what's surprising is that Moodle didn't report that error.

'spirit of sharing', Ken