Skip to content

Commit dc4d7c8

Browse files
committed
Learnpath: Remove uploaded SCORM/AICC file immediately after treatment - refs BT#22563
1 parent 57d8ccd commit dc4d7c8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main/lp/lp_upload.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@
171171
case 'scorm':
172172
$oScorm = new scorm();
173173
$manifest = $oScorm->import_local_package($s, $current_dir);
174+
// The file was treated, it can now be cleaned from the temp dir
175+
unlink($s);
174176
if (!empty($manifest)) {
175177
$oScorm->parse_manifest($manifest);
176178
$oScorm->import_manifest(api_get_course_id(), $_REQUEST['use_max_score']);
@@ -192,6 +194,8 @@
192194
case 'aicc':
193195
$oAICC = new aicc();
194196
$config_dir = $oAICC->import_local_package($s, $current_dir);
197+
// The file was treated, it can now be cleaned from the temp dir
198+
unlink($s);
195199
if (!empty($config_dir)) {
196200
$oAICC->parse_config_files($config_dir);
197201
$oAICC->import_aicc(api_get_course_id());
@@ -211,6 +215,10 @@
211215
break;
212216
case '':
213217
default:
218+
// There was an error, clean the file from the temp dir
219+
if (is_file($s)) {
220+
unlink($s);
221+
}
214222
Display::addFlash(
215223
Display::return_message(get_lang('ScormUnknownPackageFormat'), 'warning')
216224
);

0 commit comments

Comments
 (0)