From a9a99afb9b0330d45de375ddf537a74765391604 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 16 Jun 2016 10:43:17 +0200 Subject: [PATCH] Handle non-existing content dir --- h5p-default-storage.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/h5p-default-storage.class.php b/h5p-default-storage.class.php index a3c70f6..2f446c1 100644 --- a/h5p-default-storage.class.php +++ b/h5p-default-storage.class.php @@ -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); + } } /**