Fixed uploading packages and export functionality with development mode.
Changed update package to save package, update package was moved from interface in january, replaced with savePackage. Added optional parameter to exportLibrary where you can pass in development folder path for the library if it lives inside development folder. HVP-147pull/21/head
parent
64de9d53f8
commit
414751aad2
|
@ -116,10 +116,13 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
|||
* Library properties
|
||||
* @param string $target
|
||||
* Where the library folder will be saved
|
||||
* @param string $developmentPath
|
||||
* Folder that library resides in
|
||||
*/
|
||||
public function exportLibrary($library, $target) {
|
||||
public function exportLibrary($library, $target, $developmentPath=NULL) {
|
||||
$folder = \H5PCore::libraryToString($library, TRUE);
|
||||
self::copyFileTree("{$this->path}/libraries/{$folder}", "{$target}/{$folder}");
|
||||
$srcPath = ($developmentPath === NULL ? "/libraries/{$folder}" : $developmentPath);
|
||||
self::copyFileTree("{$this->path}{$srcPath}", "{$target}/{$folder}");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,6 +256,8 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
|||
* To path
|
||||
* @return boolean
|
||||
* Indicates if the directory existed.
|
||||
*
|
||||
* @throws Exception Unable to copy the file
|
||||
*/
|
||||
private static function copyFileTree($source, $destination) {
|
||||
if (!self::dirReady($destination)) {
|
||||
|
|
|
@ -1550,8 +1550,25 @@ Class H5PExport {
|
|||
$library = $dependency['library'];
|
||||
|
||||
try {
|
||||
$exportFolder = NULL;
|
||||
|
||||
// Determine path of export library
|
||||
if (isset($this->h5pC) && isset($this->h5pC->h5pD)) {
|
||||
|
||||
// Tries to find library in development folder
|
||||
$isDevLibrary = $this->h5pC->h5pD->getLibrary(
|
||||
$library['machineName'],
|
||||
$library['majorVersion'],
|
||||
$library['minorVersion']
|
||||
);
|
||||
|
||||
if ($isDevLibrary !== NULL) {
|
||||
$exportFolder = "/" . $library['path'];
|
||||
}
|
||||
}
|
||||
|
||||
// Export required libraries
|
||||
$this->h5pC->fs->exportLibrary($library, $tmpPath);
|
||||
$this->h5pC->fs->exportLibrary($library, $tmpPath, $exportFolder);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
|
||||
|
|
Loading…
Reference in New Issue