Bug #5535 - Database module backup error in 1.5.4, patch submitted by Patrick Pollet ; merged from MOODLE_16_STABLE

This commit is contained in:
skodak 2006-06-06 15:12:51 +00:00
parent ba5d423b21
commit 3cdd4eeba0
2 changed files with 16 additions and 2 deletions

View File

@ -44,7 +44,14 @@ function data_backup_mods($bf,$preferences) {
// iterate
if ($datas = get_records('data','course',$preferences->backup_course,"id")) {
foreach ($datas as $data) {
if (backup_mod_selected($preferences,'data',$data->id)) {
if (function_exists('backup_mod_selected')) {
// Moodle 1.6
$backup_mod_selected = backup_mod_selected($preferences, 'data', $data->id);
} else {
// Moodle 1.5
$backup_mod_selected = true;
}
if ($backup_mod_selected) {
$status = data_backup_one_mod($bf,$preferences,$data);
// backup files happens in backup_one_mod now too.
}

View File

@ -90,7 +90,14 @@ function data_restore_mods($mod,$restore) {
backup_putid($restore->backup_unique_code,$mod->modtype,
$mod->id, $newid);
//Now check if want to restore user data and do it.
if (restore_userdata_selected($restore,'data',$mod->id)) {
if (function_exists('restore_userdata_selected')) {
// Moodle 1.6
$restore_userdata_selected = restore_userdata_selected($restore, 'data', $mod->id);
} else {
// Moodle 1.5
$restore_userdata_selected = $restore->mods['data']->userinfo;
}
if ($restore_userdata_selected) {
//Restore data_fields first!!! need to hold an array of [oldid]=>newid due to double dependencies
$status = data_fields_restore_mods ($mod->id, $newid, $info, $restore);
$status = data_records_restore_mods ($mod->id, $newid, $info, $restore);