From: skodak Date: Tue, 6 Jun 2006 15:12:51 +0000 (+0000) Subject: Bug #5535 - Database module backup error in 1.5.4, patch submitted by Patrick Pollet... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3cdd4eeba039bbee8f29a1178a6e9310f6940d77;p=moodle.git Bug #5535 - Database module backup error in 1.5.4, patch submitted by Patrick Pollet ; merged from MOODLE_16_STABLE --- diff --git a/mod/data/backuplib.php b/mod/data/backuplib.php index ab54da2f7a..921e1d51ae 100644 --- a/mod/data/backuplib.php +++ b/mod/data/backuplib.php @@ -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. } diff --git a/mod/data/restorelib.php b/mod/data/restorelib.php index 93def2de88..a6d76ce92a 100644 --- a/mod/data/restorelib.php +++ b/mod/data/restorelib.php @@ -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);