From 71763222e25e69df2aa52d189c20f3a2090eed19 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Sun, 24 Feb 2013 00:12:57 +0100 Subject: [PATCH] Save dependencies by library id instead of by machine_name and version --- h5p.classes.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/h5p.classes.php b/h5p.classes.php index 7b941dc..58282da 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -675,6 +675,18 @@ class H5PStorage { $this->h5pC->delTree($destination_path); rename($current_path, $destination_path); } + foreach ($this->h5pC->librariesJsonData as $key => &$library) { + // All libraries have been saved, we now save all the dependencies + if (isset($library['preloadedDependencies'])) { + $this->h5pF->saveLibraryDependencies($library['libraryId'], $library['preloadedDependencies'], 'preloaded'); + } + if (isset($library['dynamicDependencies'])) { + $this->h5pF->saveLibraryDependencies($library['libraryId'], $library['dynamicDependencies'], 'dynamic'); + } + if (isset($library['editorDependencies'])) { + $this->h5pF->saveLibraryDependencies($library['libraryId'], $library['editorDependencies'], 'editor'); + } + } $current_path = $this->h5pF->getUploadedH5pFolderPath() . DIRECTORY_SEPARATOR . 'content'; $destination_path = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . $contentId; rename($current_path, $destination_path);