]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16137 - clear scorm directory if it already exists
authordanmarsden <danmarsden>
Wed, 27 Aug 2008 22:38:52 +0000 (22:38 +0000)
committerdanmarsden <danmarsden>
Wed, 27 Aug 2008 22:38:52 +0000 (22:38 +0000)
mod/scorm/lib.php

index 7bf6dee6e9b5f090fb63ac1358813205d57069aa..51a53979ebdf9622f4a09af13089aac528e160fa 100755 (executable)
@@ -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);
         }