Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug 3443 and the file not found error on restored scorms

  • Loading branch information...
commit e61fd9ab1619d44836ccaba88671862795045504 1 parent 3471fa7
bobopinna authored
Showing with 16 additions and 6 deletions.
  1. +16 −6 mod/scorm/restorelib.php
View
22 mod/scorm/restorelib.php
@@ -56,7 +56,12 @@ function scorm_restore_mods($mod,$restore) {
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']['#']);
$scorm->width = backup_todb($info['MOD']['#']['WIDTH']['0']['#']);
@@ -79,13 +84,19 @@ function scorm_restore_mods($mod,$restore) {
//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 +336,7 @@ function scorm_restore_files ($package, $restore) {
//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 +347,6 @@ function scorm_restore_files ($package, $restore) {
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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.