Skip to content
Snippets Groups Projects
Commit 8480d24f authored by Mark Johnson's avatar Mark Johnson
Browse files

Fix paths for update files.

Fixes #453

The previous code could result in a curl error if $CFG->tempdir didn't
already exist, and a chmod error if it did exist as it was being passed
$stream as a file resource rather than a string.

Change-Id: Ia1b0c22c380d3ba4e57e7f1b85d414db45ba9106
parent 77dd8cf1
Branches
No related tags found
No related merge requests found
......@@ -215,15 +215,15 @@ class framework implements \H5PFrameworkInterface {
@set_time_limit(0);
// Generate local tmp file path.
$localfolder = $CFG->tempdir . uniqid('/hvp-');
$stream = $localfolder . '.h5p';
$localfolder = make_temp_directory(uniqid('hvp-'));
$localpath = $localfolder . '.h5p';
// Add folder and file paths to H5P Core.
$interface = self::instance('interface');
$interface->getUploadedH5pFolderPath($localfolder);
$interface->getUploadedH5pPath($stream);
$interface->getUploadedH5pPath($localpath);
$stream = fopen($stream, 'w');
$stream = fopen($localpath, 'w');
$options['CURLOPT_FILE'] = $stream;
}
......@@ -244,7 +244,7 @@ class framework implements \H5PFrameworkInterface {
if ($stream !== null) {
fclose($stream);
@chmod($stream, $CFG->filepermissions);
@chmod($localpath, $CFG->filepermissions);
}
$errorno = $curl->get_errno();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment