MDL-52459 mod_scorm: Auto-update downloaded packages

This commit is contained in:
Juan Leyva
2015-12-29 12:43:25 +01:00
parent 0dfcc2541a
commit 7f062ebedd
+3 -3
View File
@@ -237,12 +237,12 @@ function scorm_parse($scorm, $full) {
// Sorry - localsync disabled.
return;
}
if ($scorm->reference !== '' and (!$full or $scorm->sha1hash !== sha1($scorm->reference))) {
if ($scorm->reference !== '') {
$fs->delete_area_files($context->id, 'mod_scorm', 'package');
$filerecord = array('contextid' => $context->id, 'component' => 'mod_scorm', 'filearea' => 'package',
'itemid' => 0, 'filepath' => '/');
if ($packagefile = $fs->create_file_from_url($filerecord, $scorm->reference, array('calctimeout' => true))) {
$newhash = sha1($scorm->reference);
if ($packagefile = $fs->create_file_from_url($filerecord, $scorm->reference, array('calctimeout' => true), true)) {
$newhash = $packagefile->get_contenthash();
} else {
$newhash = null;
}