Merge from MOODLE_14_STABLE

Fix for bug 2227 "bug in pclzip.php causing scorm errors"
http://moodle.org/bugs/bug.php?op=show&bugid=2227

Credits go to skodak
This commit is contained in:
martinlanghoff
2004-11-26 00:57:58 +00:00
parent a2ddd957f2
commit 1da35f2942
+1 -10
View File
@@ -35,16 +35,7 @@
if ($scormdir = make_upload_directory("$course->id/$CFG->moddata/scorm")) {
if ($tempdir = scorm_datadir($scormdir, $form->datadir)) {
copy ("$coursedir/$form->reference", $tempdir."/".basename($form->reference));
if (empty($CFG->unzip)) { // Use built-in php-based unzip function
include_once($CFG->dirroot.'/lib/pclzip/pclzip.lib.php');
$archive = new PclZip($tempdir."/".basename($form->reference));
if (!$list = $archive->extract($tempdir)) {
error($archive->errorInfo(true));
}
} else {
$command = "cd $tempdir; $CFG->unzip -o ".basename($form->reference)." 2>&1";
exec($command);
}
unzip_file($tempdir."/".basename($form->reference), $tempdir, false);
$result = scorm_validate($tempdir."/imsmanifest.xml");
} else {
$result = "packagedir";