Fixed some bugs in restore procedure, added backup and restore for field popup

This commit is contained in:
bobopinna
2005-06-29 07:49:44 +00:00
parent 96ca8c6cc6
commit f91f72167e
2 changed files with 27 additions and 6 deletions
+1
View File
@@ -50,6 +50,7 @@
fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary));
fwrite ($bf,full_tag("BROWSEMODE",4,false,$scorm->browsemode));
fwrite ($bf,full_tag("AUTO",4,false,$scorm->auto));
fwrite ($bf,full_tag("POPUP",4,false,$scorm->popup));
fwrite ($bf,full_tag("WIDTH",4,false,$scorm->width));
fwrite ($bf,full_tag("HEIGHT",4,false,$scorm->height));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$scorm->timemodified));
+26 -6
View File
@@ -56,9 +56,24 @@
if (!is_int($scorm->grademethod)) {
$scorm->grademethod = 0;
}
$scorm->launch = backup_todb($info['MOD']['#']['LAUNCH']['0']['#']);
if ($restore->backup_version < 2005041500) {
$scorm->datadir = substr(backup_todb($info['MOD']['#']['DATADIR']['0']['#']),1);
} else {
$scorm->datadir = backup_todb($info['MOD']['#']['ID']['0']['#']);
}
$oldlaunch = backup_todb($info['MOD']['#']['LAUNCH']['0']['#']);
$scorm->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
$scorm->auto = backup_todb($info['MOD']['#']['AUTO']['0']['#']);
if ($restore->backup_version < 2005040200) {
$oldpopup = backup_todb($info['MOD']['#']['POPUP']['0']['#']);
if (!empty($oldpopup)) {
$scorm->popup = 1;
} else {
$scorm->popup = 0;
}
} else {
$scorm->popup = backup_todb($info['MOD']['#']['POPUP']['0']['#']);
}
$scorm->width = backup_todb($info['MOD']['#']['WIDTH']['0']['#']);
if ($scorm->width == 0) {
$scorm->width = 800;
@@ -79,13 +94,19 @@
//We have the newid, update backup_ids
backup_putid($restore->backup_unique_code,$mod->modtype,
$mod->id, $newid);
$scorm->id = $newid;
//Now copy moddata associated files
$status = scorm_restore_files ($scorm, $restore);
if ($status)
if ($status) {
$status = scorm_scoes_restore_mods ($newid,$info,$restore);
if ($status) {
$launchsco = backup_getid($restore->backup_unique_code,"scorm_scoes",$oldlaunch);
$scorm->launch = $launchsco->new_id;
update_record('scorm',$scorm);
}
}
} else {
$status = false;
}
@@ -325,7 +346,7 @@
//Now locate the temp dir we are restoring from
if ($status) {
$temp_path = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code.
"/moddata/scorm/".$package->id;
"/moddata/scorm/".$package->datadir;
//Check it exists
if (is_dir($temp_path)) {
$todo = true;
@@ -336,7 +357,6 @@
if ($status and $todo) {
//Make scorm package directory path
$this_scorm_path = $scorm_path."/".$package->id;
$status = backup_copy_file($temp_path, $this_scorm_path);
}