Merge branch 'master' into ignoreBuildFiles

pull/27/head
thomasmars 2016-10-21 09:55:08 +02:00
commit 0474ed89af
4 changed files with 47 additions and 7 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
vendor
*~ *~

View File

@ -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", "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": { "autoload": {
"files": [ "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"
] ]
} }
} }

View File

@ -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.");
}
} }
/** /**

View File

@ -553,6 +553,11 @@ interface H5PFrameworkInterface {
* return int * return int
*/ */
public function getLibraryContentCount(); public function getLibraryContentCount();
/**
* Will trigger after the export file is created.
*/
public function afterExportCreated();
} }
/** /**
@ -1595,9 +1600,11 @@ 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);
$this->h5pF->afterExportCreated();
return true; return true;
} }
@ -1669,7 +1676,7 @@ class H5PCore {
public static $coreApi = array( public static $coreApi = array(
'majorVersion' => 1, 'majorVersion' => 1,
'minorVersion' => 9 'minorVersion' => 10
); );
public static $styles = array( public static $styles = array(
'styles/h5p.css', 'styles/h5p.css',