Fixes for Bug 5749 and Bug 5750

summary of bug 5749 and 5750
fixes for: function causes timeout when deleting temporary files for large scorm objects
scorm\validate.php calls function scorm_delete_files from scorm\lib.php - but lib.php not included in validate.php

Validation of Scorm objects broken - adds entry in modules database even when scorm object is not created.
This commit is contained in:
danmarsden 2006-07-23 23:48:09 +00:00
parent 1e0c4d67fd
commit e4aa175a92
3 changed files with 2762 additions and 2757 deletions

View File

@ -57,7 +57,9 @@ if (!isset($CFG->scorm_framewidth)) {
* @return int
*/
function scorm_add_instance($scorm) {
if(empty($scorm->datadir)) { //check to make sure scorm object is valid BEFORE entering it in the database.
error(get_string('nomanifest', 'scorm'));
} else {
global $CFG;
$scorm->timemodified = time();
@ -86,6 +88,7 @@ function scorm_add_instance($scorm) {
}
return $id;
}
}
/**
@ -514,6 +517,7 @@ function scorm_delete_files($directory) {
scorm_delete_files($directory.'/'.$file);
}
}
set_time_limit(5);
}
rmdir($directory);
return true;

View File

@ -71,7 +71,7 @@ function scorm_validate($packagedir) {
}
closedir($handle);
}
if (!isset($validation)) {
if (!isset($validation->result)) {
$validation->result = 'nomanifest';
$validation->pkgtype = 'SCORM';
}

View File

@ -2,6 +2,7 @@
require_once("../../config.php");
require_once('locallib.php');
require_once('lib.php');
$courseid = required_param('id', PARAM_INT); // Course Module ID, or
$reference = required_param('reference', PARAM_PATH); // Package path