Merge pull request #28 from limikael/master

don't fail silently in createExportFile
pull/29/head
Frode Petterson 2016-09-30 11:31:17 +02:00 committed by GitHub
commit 0a9aa5a783
2 changed files with 10 additions and 2 deletions

View File

@ -132,11 +132,18 @@ class H5PDefaultStorage implements \H5PFileStorage {
* Path on file system to temporary export file.
* @param string $filename
* Name of export file.
* @throws Exception Unable to save the file
*/
public function saveExport($source, $filename) {
$this->deleteExport($filename);
self::dirReady("{$this->path}/exports");
copy($source, "{$this->path}/exports/{$filename}");
if (!self::dirReady("{$this->path}/exports")) {
throw new Exception("Unable to create directory for H5P export file.");
}
if (!copy($source, "{$this->path}/exports/{$filename}")) {
throw new Exception("Unable to save H5P export file.");
}
}
/**

View File

@ -1595,6 +1595,7 @@ Class H5PExport {
}
catch (Exception $e) {
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
return false;
}
unlink($tmpFile);