commit
0a9aa5a783
|
@ -132,11 +132,18 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||||
* Path on file system to temporary export file.
|
* Path on file system to temporary export file.
|
||||||
* @param string $filename
|
* @param string $filename
|
||||||
* Name of export file.
|
* Name of export file.
|
||||||
|
* @throws Exception Unable to save the file
|
||||||
*/
|
*/
|
||||||
public function saveExport($source, $filename) {
|
public function saveExport($source, $filename) {
|
||||||
$this->deleteExport($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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1595,6 +1595,7 @@ Class H5PExport {
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
|
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
|
|
Loading…
Reference in New Issue