mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +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
|
@ -346,8 +346,28 @@ class mod_scorm_mod_form extends moodleform_mod {
|
|||
make_temp_directory('scormimport');
|
||||
$file->copy_content_to($filename);
|
||||
|
||||
$errors = array_merge($errors, scorm_validate_package($filename));
|
||||
$packer = get_file_packer('application/zip');
|
||||
|
||||
$filelist = $packer->list_files($filename);
|
||||
if (!is_array($filelist)) {
|
||||
$errors['packagefile'] = 'Incorrect file package - not an archive'; //TODO: localise
|
||||
} 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 and !$aiccfound) {
|
||||
$errors['packagefile'] = 'Incorrect file package - missing imsmanifest.xml or AICC structure'; //TODO: localise
|
||||
}
|
||||
}
|
||||
unlink($filename);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue