Skip to content
Snippets Groups Projects
Commit 146aa20e authored by Frode Petterson's avatar Frode Petterson
Browse files

Use course context for tmp files

h5p/h5p-moodle-plugin#112
parent 10304d02
No related branches found
No related tags found
No related merge requests found
...@@ -553,9 +553,17 @@ class file_storage implements \H5PFileStorage { ...@@ -553,9 +553,17 @@ class file_storage implements \H5PFileStorage {
* @param string $file path + name * @param string $file path + name
*/ */
private function getFile($filearea, $itemid, $file) { private function getFile($filearea, $itemid, $file) {
// Grab cm context global $COURSE;
if ($filearea === 'editor') {
// Use Course context
$context = \context_course::instance($COURSE->id);
}
else {
// Use CM context
$cm = \get_coursemodule_from_instance('hvp', $itemid); $cm = \get_coursemodule_from_instance('hvp', $itemid);
$context = \context_module::instance($cm->id); $context = \context_module::instance($cm->id);
}
// Load file // Load file
$fs = get_file_storage(); $fs = get_file_storage();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment