Handle non-existing content dir

pull/22/head
Frode Petterson 2016-06-16 10:43:17 +02:00
parent 94d3334f37
commit a9a99afb9b
1 changed files with 9 additions and 1 deletions

View File

@ -109,7 +109,15 @@ class H5PDefaultStorage implements \H5PFileStorage {
* Where the content folder will be saved
*/
public function exportContent($id, $target) {
self::copyFileTree("{$this->path}/content/{$id}", $target);
$source = "{$this->path}/content/{$id}";
if (file_exists($source)) {
// Copy content folder if it exists
self::copyFileTree("{$this->path}/content/{$id}", $target);
}
else {
// No contnet folder, create emty dir for content.json
self::dirReady($target);
}
}
/**