I've created a course backup from a Moodle 1.9.3 installation. I've tried to restore the course (creating a new course) on a Moodle 1.9.4, a Moodle4Mac installed on my Macbook Pro for testing.
Each time an error is displayed during the module part:
Creating course modules:
Resource "Course Overview"
Could not restore modules!
The restore continues through to "Closing the Restorelog.html file", but then at the end it says, "An error occured and the restore could not be completed."
Any tips about what might be hanging up the restore?
Thanks
Pauline
Apparently none of the web pages we created in Moodle are being included in the course backup. A backup that someone else made of the same course had the same problem: They restored our course but all the web pages were missing. (I was not able to restore. It stopped each time a web page came up in the restore.)
Any reason why no web pages would get included in the backup? I'm doing a backup of all (without user data).
Thanks for any tips,
Pauline
This happens with different course's backup, also at the Creating course modules part. I'm using a backup from a Moodle 1.9.3 installation at our institution and trying to restore to a local install on my Mac. The problem has occurred also on a sandbox Moodle on the institution's server.
Any clues? Much appreciate any help.
Thanks,
Pauline
Here's what gets displayed during the failed restore process:
Course restore: sicherung-skrips_scientific_writing-20090311-1643.zip
|
I got the same problem when i try to restore a course. I upgraded my moodle site from 1.8.5+ to 1.9.4+.
PLEASE HELP US!!!!!
I also have the same problem restoring from Moodle 1.9.4. (online) to 1.9.4 (local PC) with the same error message that Pauline shows.
I've discovered that if I restore the course locally without the user data it restores successfully. However, the user data is essential to what I want to do.
I have added a Word file with screencaptures of the settings I used and the error message.
I'll continue experimenting but help would be appreciated.
Cheers,
Glenys
Yet more info on the backup, taken from what is displayed at the beginning of the restore:
Moodle Version: | 1.9.4 (Build: 20090128) (2007101540) |
Backup Version: | 1.9.3 (2008030301) |
I'm restoring (or trying) to a local Moodle version 1.9.4+ (Build: 20090207).
Plodding on...
Thanks for any clues,
Pauline
I've discovered I can restore the course if I include all the user data except the user data for forums (just what I need to have, of course).
Is this the same for you, Pauline?
I have rather a lot of forums, so it'll take me a while to find out if it's just one that's causing the problem.
The course itself is accessible here Apprendre Moodle, if anyone knowlegeable would be willing to to take a look.
Cheers,
Glenys
I am also having this problem restoring old backups from various versions of Moodle to 1.9.4. Exactly the same symptoms.
If anyone monitors this thread I can provide access to the site in question.
Any help would be greatly appreciated.
Richard Jones
I just tried doing the backup with user data except for the forums and the restore balked again at creating course modules: "Could not restore modules!". Alas.
Guess I'll try some different combinations of data included and see if I have any success. It *is* encouraging to know that you got a restore to work to completion, even if it's not exactly as you'd hoped.
Anyone else with any clues?
Thanks much!
Pauline
Yes, I do mean I do a backup with all user data but then restore without the user data for fourms.
As we don't seem to be getting any answers from developers here, I'll put something in the tracker tomorrow: that's where the big boys hang out.
I'm always a bit nervous of posting things in the tracker in case I'm wasting their time with a trivial problem I've created myself, but there seem to a bunch of us with this same problem.
Cheers,
Glenys
Thanks for posting on the Moodle Tracker. Here is a workaround you might try. If you do not know what php.ini is, it is an editable file which sets defaults for your PHP on the server. Those PHP settings affect Moodle operation. If you have FTP access to your server, you can change these. If you don't, show these settings to someone who does and ask them to do it.
memory_limit = 1024MB
max_execution_time = 120
Little Don
Thanks for the possible workaround Don. The Moodle installation I'm trying to restore to is local on my computer, so I do have access to php.ini.
I made those two changes, restarted the server and... alas, no luck. The restore still cannot get through "Creating course modules" and displays "Could not restore modules!" and "An error has occurred and the restore could not be completed!".
Thanks for entering this in the tracker Glenys.
Still hunting, any tips much appreciated.
Regards,
Pauline
I think we have the same backup forum issue here... i recentrly tried to restore a backup from a older version (moodle 1.8.4) to the moodle 195, but unfortunatelly for my surprise there's this message "could not restore modules"...
here's the trick:
go to your older moodle version and open this file:
MOODLE_FOLDER/backup/restorelib.php
and look for this function :
-----------------------------------------------------
//This function creates all the structures for every module in backup file
//Depending what has been selected.
function restore_create_modules($restore,$xml_file) {
global $CFG;
$status = true;
//Check it exists
if (!file_exists($xml_file)) {
$status = false;
}
//Get info from xml
if ($status) {
//info will contain the id and modtype of every module
//in backup_ids->info will be the real info (serialized)
$info = restore_read_xml_modules($restore,$xml_file);
}
//Now, if we have anything in info, we have to restore that mods
//from backup_ids (calling every mod restore function)
if ($info) {
if ($info !== true) {
if (!defined('RESTORE_SILENTLY')) {
echo '<ul>';
}
//Iterate over each module
foreach ($info as $mod) {
if (empty($restore->mods[$mod->modtype]->granular) // We don't care about per instance, i.e. restore all instances.
|| (array_key_exists($mod->id,$restore->mods[$mod->modtype]->instances)
&& !empty($restore->mods[$mod->modtype]->instances[$mod->id]->restore))) {
$modrestore = $mod->modtype."_restore_mods";
if (function_exists($modrestore)) { //Debug
$status = $status and $modrestore($mod,$restore); //bit operator & not reliable here!
} else {
//Something was wrong. Function should exist.
$status = false;
}
}
}
if (!defined('RESTORE_SILENTLY')) {
echo '</ul>';
}
}
} else {
$status = false;
}
return $status;
}
-----------------------------------------------------
okay, now you find the function, you're gonna look for your newer moodle version and replace it !
remember after restore your backup, return to the original function.
We can go from there
Here's what comes up, saved as html.
Thanks again, appreciate it,
Pauline
Thanks for coming to play with us.
I'm also restoring to a local version - but on PC.
I changed the php.ini:
memory_limit = 1024MB
max_execution_time = 120
but it made no difference.
I downloaded and installed the most recent version of Moodle for Windows and tried again after enabling debugging.
I've attached the error message.
I'm afraid I don't understand what it means.
Cheers,
Glenys
I think this is a serious bug in that I can no longer backup or restore a course. Everything was working fine last week.
Can someone tell me what happened between Friday and last night?
russ
I had debugging on "ALL", will now change to "DEVELOPER" and run through a restore again. Be right back...
It would be fantastic if you try with the backup file I have, thank you! I'll find a place to put the backup file and let you know via email, OK?
Thanks!
Pauline
Thanks again!
Pauline
The backup was made on a Moodle version 1.9.4 (20090128).
The restore was done on a local installation with the most recent update 1.9.4+ (20090401).
Thanks!
The debug message said that the 'reference' column for 'mdl_resource' could not be null. So I changed that column's null property to yes in the database. Then the restore worked. Yeeha.
Doing restore in version 1.9.4+ (weekly 20090401).
MySQL 5.0.19, PHP 5.1.6
Now the real question is, what will this change break elsewhere??
I did the database change on a local installation where it doesn't really matter, and wouldn't advise doing this on a real installation, whether test or production, until a moodle developer says otherwise.
Howard? stronk7?
Cheers,
Pauline
* Did it fail because the field should not have been "not null"?
* Did it fail because the code should not have been writing a null to that field?
I have no idea........ let's just hope you backed the right horse as it where
Fundamentally, the problem was with the backup part of the process not the restore. This has happened because there (almost certainly) where NULLs in the database field 'reference' in mdl_resource. I would want to check if that was a possibility.
I had a quick look at the db code and it doesn't look like anything has changed in those definitions for years (the oldest site I have is 1.6 and that is still 'not null'). So if it turns out, in the source Moodle, that you have NULLs in that field you have a kind of low-level data corruption. If your Moodle site has been upgraded a few times this is quite a common occurrence (due to inconsistencies in the db upgrade code).
Without doing some more digging that field's contents are dependent on what resource type it is. If a file link it will have the file reference otherwise it contains a number (always an empty string for me for 'html' resource types) but I don't remember what that means.
EDIT:
Just checking.... is the 1.9.3 install using MySQL?
Thanks so much for digging into that for me.
"So if it turns out, in the source Moodle, that you have NULLs in that field you have a kind of low-level data corruption. If your Moodle site has been upgraded a few times this is quite a common occurrence (due to inconsistencies in the db upgrade code)."
This could very well be the case, but I don't know. I'll try to get the support folks to take a look at this discussion and maybe give some input.
So that data corruption... do you mean that somehow the database where the backup is being made has numbers or empty strings and has converted them to NULLs?
What would you suggest to fix the problem? Is there something the support folks can do to clean out the NULLs and prevent them from occurring in future?
"EDIT:
Just checking.... is the 1.9.3 install using MySQL?""
Correction: The backup came from a 1.9.4 (20090128) install (I had noted that incorrectly above).
I don't know what kind of database it's using - again I'll have to ask the institution's support folks if they can come by and complete that info.
Thanks again Howard!
Pauline
I'm working for the institution support Paulines courses are located in.
We are using 1.9.4 ((20090128) with PostgreSQL 8.1.11 (operating system) and 8.1.9 on the test site (where we tried to import the course).
Howard, thank you for the hint. We have changed the "Not-NULL"-statement in the import-database and the import worked fine.
This action solved our problem but not the problem of the database on our live system. Is there a way to correct the corruption?
Regards
Thomas
Just to make it absolutely clear...
The live system that Thomas refers to is the one that produced the corrupted backup. We'll need to create backups for a number of courses from that system.
Thanks much for your help,
Pauline
reference | character varying(255) |
But the same column (mdl_resource.reference) in the new install looked like this:
reference | character varying(255) | not null default ''::character varying
I did not want to remove the 'not null' constraint from the new install so in order to get backup/restore working from the production system I repaired the database on the production system by replacing all of the null values with the empty string '' and then adding the 'not null' and the default '' constraints to the production table. After I repaired the database I did a new backup from the production system (actually from a repaired clone of the production system) and was able to restore in the fresh install of Moodle 1.9.6+ without any issues. Below is the procedure that I used, please note that I did a clone of our production system and upgraded the clone from 1.9.5+ to 1.9.6+ just to be safe. This may or may not be necessary.
- Cloned our production system to a new server (basically did a restore from a full backup of production onto a new server)
- Upgraded the clone from 1.9.5+ to 1.9.6+ (just to be safe, might not be necessary)
- Used psql to connect to the database being used by the clone
- Replaced all the null values with an empty string
- update mdl_resource set reference = '' where reference is null;
- Verified that no null values remained (below query returned 0 rows)
- select count(*) from mdl_resource where reference is null;
- Added the default value of '' to the column
- alter table mdl_resource alter column reference set default '';
- Added the 'not null' constraint to the column
- alter table mdl_resource alter column reference set not null;
- Examined the table to make sure that the changes looked correct
- \d mdl_resource;
The size of the backup is 3.7 Mb
Restore problems
I thought I will share with you guys am not sure whether this will help you in any ways.
The live server with all three kinds of options (new course, adding it to existing course, deleting it first and new course) selected seems to work fine.
The restore procedure takes much longer than 1.8.2+ version
Server spec.
Moodle version - upgraded from 1.8.2+ since july 2008 to 1.9.2
Windows server 2003, Php 5.2.3 Apache 2.2.3 Mysql 5.0.45
Memory - 16 GB
Cpu intel xeon 5355 2.66 GHZ
Php.ini
memory_limit = 512MB
max_execution_time = 120
On the Testing server all three kinds of options (new course, adding it to existing course, deleting it first and new course) seems to fail ONLY if certain modules (e.g questionnaire) were included in the backup. other wise it seems to work fine
However there was a backup of 5 mb without questionnaire module did not work on Testing Server but it worked fine on live server.
Error message from testing server: - An error has occurred and the restore could not be completed!
Server spec.
1.9.2
Windows server 2003, Php 5.2.3 Apache 2.2.3 Mysql 5.0.45
Memory – 2 GB
Cpu intel ® xeon 2.39 GHZ
memory_limit = 128MB
max_execution_time = 120
I think it could be that because the live server has more processing power and 16 gb memory otherwise it is exactly same as testing server (source code)
Hello everyone !
I have the "Could not restore modules" problem too...
Like Pauline, I created a backup on a Moodle 1.9.11 online installation and I tried to restore the course on a Moodle 1.9.19 (Moodle4Mac).
The problem occurs everytime I try to restore a course with Nanogong data (The "could not restore" message appears after trying to restore the Nanogong exercises). I tried to restore the courses without these data and it works perfectly ! But sadly, even if I'm pretty sure the problem come from the Nanogong add-on, I can't do without it...
I enabled debugging (full and developper), but I have absolutely no error message, except the "Could not restore" one. So I'm totally blind here. :/
Could anyone help me on this ?
Thank you for your help ! ;)
I'm sorry to "up" this post but i'm definitely in need for help on this one...
Does anyone have any clue on what should I do to work out this problem with Nanogong backup ?
Best regards,
Yann