From ce796cf0cf011084320b7bea0c724dd212351f6e Mon Sep 17 00:00:00 2001 From: Mikael Lindqvist Date: Mon, 26 Sep 2016 12:05:02 +0200 Subject: [PATCH 1/4] don't fail silently in createExportFile --- h5p-default-storage.class.php | 11 +++++++++-- h5p.classes.php | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/h5p-default-storage.class.php b/h5p-default-storage.class.php index a1cd27f..4d0385f 100644 --- a/h5p-default-storage.class.php +++ b/h5p-default-storage.class.php @@ -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."); + } } /** diff --git a/h5p.classes.php b/h5p.classes.php index c1892cd..4d903af 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1595,6 +1595,7 @@ Class H5PExport { } catch (Exception $e) { $this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage())); + return false; } unlink($tmpFile); From e4266efb222d870acce46ff5a036728aa5a3e865 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Fri, 30 Sep 2016 13:41:50 +0200 Subject: [PATCH 2/4] Added framework method to clear dirsize cache HFP-23 --- h5p.classes.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/h5p.classes.php b/h5p.classes.php index 4d903af..4a3203a 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -553,6 +553,11 @@ interface H5PFrameworkInterface { * return int */ public function getLibraryContentCount(); + + /** + * Will trigger after the export file is created. + */ + public function afterExportCreated(); } /** @@ -1599,6 +1604,7 @@ Class H5PExport { } unlink($tmpFile); + $this->h5pF->afterExportCreated(); return true; } From bf554b8ee281cda79639d2c52dc929f9ec810951 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Fri, 7 Oct 2016 13:39:51 +0200 Subject: [PATCH 3/4] Updated composer config --- .gitignore | 2 ++ composer.json | 32 ++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b25c15b..9577d19 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +vendor *~ + diff --git a/composer.json b/composer.json index 5f423f9..fac6c53 100644 --- a/composer.json +++ b/composer.json @@ -1,10 +1,34 @@ { - "name": "h5p/h5p-php-library", + "name": "h5p/h5p-core", + "type": "library", + "description": "H5P Core functionality in PHP", + "keywords": ["h5p","hvp","interactive","content","quiz"], + "homepage": "https://h5p.org", "license": "GPL-3.0", + "authors": [ + { + "name": "Svein-Tore Griff With", + "email": "with@joubel.com", + "homepage": "http://joubel.com", + "role": "CEO" + }, + { + "name": "Frode Petterson", + "email": "frode.petterson@joubel.com", + "homepage": "http://joubel.com", + "role": "Developer" + } + ], + "require": { + "php": ">=5.3.0" + }, "autoload": { "files": [ - "h5p-development.class.php", - "h5p.classes.php" + "h5p.classes.php", + "h5p-development.class.php", + "h5p-file-storage.interface.php", + "h5p-default-storage.class.php", + "h5p-event-base.class.php" ] } -} \ No newline at end of file +} From f28036ca0ea2e997773a756d0d277edd03a246f4 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Fri, 21 Oct 2016 09:53:59 +0200 Subject: [PATCH 4/4] Bumped core API version because of API changes in editor --- h5p.classes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index 4a3203a..4d7223b 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1676,7 +1676,7 @@ class H5PCore { public static $coreApi = array( 'majorVersion' => 1, - 'minorVersion' => 9 + 'minorVersion' => 10 ); public static $styles = array( 'styles/h5p.css',