don't fail silently in createExportFile

pull/28/head
Mikael Lindqvist 2016-09-26 12:05:02 +02:00
parent 1c5b9707e5
commit ce796cf0cf
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);