mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 04:33:13 +01:00
added backup/restore compatibility for Moodle 1.5 (and earlier)
This commit is contained in:
parent
3e42156be5
commit
ea2cf99599
@ -44,15 +44,22 @@
|
||||
$hotpots = get_records ("hotpot","course",$preferences->backup_course,"id");
|
||||
if ($hotpots) {
|
||||
foreach ($hotpots as $hotpot) {
|
||||
if (backup_mod_selected($preferences,'hotpot',$hotpot->id)) {
|
||||
$status = hotpot_backup_one_mod($bf,$preferences,$hotpot->id);
|
||||
if (function_exists('backup_mod_selected')) {
|
||||
// Moodle >= 1.6
|
||||
$backup_mod_selected = backup_mod_selected($preferences, 'hotpot', $hotpot->id);
|
||||
} else {
|
||||
// Moodle <= 1.5
|
||||
$backup_mod_selected = true;
|
||||
}
|
||||
if ($backup_mod_selected) {
|
||||
$status = hotpot_backup_one_mod($bf, $preferences, $hotpot->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
function hotpot_backup_one_mod($bf, $preferences, $instance = 0) {
|
||||
function hotpot_backup_one_mod($bf, $preferences, $instance=0) {
|
||||
// $bf : resource id for b(ackup) f(ile)
|
||||
// $preferences : object containing switches and settings for this backup
|
||||
$level = 3;
|
||||
@ -65,7 +72,14 @@
|
||||
$record_tags = array('MODTYPE'=>'hotpot');
|
||||
$excluded_tags = array();
|
||||
$more_backup = '';
|
||||
if (backup_userdata_selected($preferences,'hotpot',$instance)) {
|
||||
if (function_exists('backup_userdata_selected')) {
|
||||
// Moodle >= 1.6
|
||||
$backup_userdata_selected = backup_userdata_selected($preferences, 'hotpot', $instance);
|
||||
} else {
|
||||
// Moodle <= 1.5
|
||||
$backup_userdata_selected = $preferences->mods['hotpot']->userinfo;
|
||||
}
|
||||
if ($backup_userdata_selected) {
|
||||
$more_backup .= '$GLOBALS["hotpot_backup_string_ids"] = array();';
|
||||
$more_backup .= '$status = hotpot_backup_attempts($bf, $record, $level, $status);';
|
||||
$more_backup .= '$status = hotpot_backup_questions($bf, $record, $level, $status);';
|
||||
|
@ -80,7 +80,14 @@ function hotpot_restore_mods($mod, $restore) {
|
||||
$more_restore .= 'print "<li>".get_string("modulename", "hotpot")." "".$record->name.""</li>";';
|
||||
}
|
||||
$more_restore .= 'backup_flush(300);';
|
||||
if (restore_userdata_selected($restore,'hotpot',$mod->id)) {
|
||||
if (function_exists('restore_userdata_selected')) {
|
||||
// Moodle >= 1.6
|
||||
$restore_userdata_selected = restore_userdata_selected($restore, 'hotpot', $mod->id);
|
||||
} else {
|
||||
// Moodle <= 1.5
|
||||
$restore_userdata_selected = $restore->mods['hotpot']->userinfo;
|
||||
}
|
||||
if ($restore_userdata_selected) {
|
||||
if (isset($xml["STRING_DATA"]) && isset($xml["QUESTION_DATA"])) {
|
||||
// HotPot v2.1+
|
||||
$more_restore .= '$status = hotpot_restore_strings($restore, $status, $xml, $record);';
|
||||
|
Loading…
x
Reference in New Issue
Block a user