From 8ba4f1e03e1c9d118becce087b5460fbbd68fe4c Mon Sep 17 00:00:00 2001 From: danmarsden Date: Wed, 27 Aug 2008 22:38:52 +0000 Subject: [PATCH] MDL-16137 - clear scorm directory if it already exists --- mod/scorm/lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 7bf6dee6e9..51a53979eb 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -47,6 +47,10 @@ function scorm_add_instance($scorm) { if (scorm_external_link($scorm->reference) || ((basename($scorm->reference) != 'imsmanifest.xml') && ($scorm->reference[0] != '#'))) { // Rename temp scorm dir to scorm id $scorm->dir = $CFG->dataroot.'/'.$scorm->course.'/moddata/scorm'; + if (file_exists($scorm->dir.'/'.$id)) { + //delete directory as it shouldn't exist! - most likely there from an old moodle install with old files in dataroot + scorm_delete_files($scorm->dir.'/'.$id); + } rename($scorm->dir.$scorm->datadir,$scorm->dir.'/'.$id); } -- 2.39.5