mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Revert "MDL-35380 SCORM: improve check for imsmanifest file and consolidate into a single function."
This reverts commit 492407e9f7
.
This commit is contained in:
parent
9ead041cdb
commit
aee8151f7d
9 changed files with 47 additions and 121 deletions
|
@ -1271,10 +1271,32 @@ function scorm_dndupload_handle($uploadinfo) {
|
|||
$file = reset($files);
|
||||
|
||||
// Validate the file, make sure it's a valid SCORM package!
|
||||
$errors = scorm_validate_package($file);
|
||||
if (!empty($errors)) {
|
||||
$packer = get_file_packer('application/zip');
|
||||
$filelist = $file->list_files($packer);
|
||||
|
||||
if (!is_array($filelist)) {
|
||||
return false;
|
||||
} else {
|
||||
$manifestpresent = false;
|
||||
$aiccfound = false;
|
||||
|
||||
foreach ($filelist as $info) {
|
||||
if ($info->pathname == 'imsmanifest.xml') {
|
||||
$manifestpresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (preg_match('/\.cst$/', $info->pathname)) {
|
||||
$aiccfound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$manifestpresent && !$aiccfound) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a default scorm object to pass to scorm_add_instance()!
|
||||
$scorm = get_config('scorm');
|
||||
$scorm->course = $uploadinfo->course->id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue