Merged in changes.

namespaces
Frode Petterson 2013-03-07 17:14:41 +01:00
parent 9c934a752a
commit 8177e0a251
1 changed files with 9 additions and 9 deletions

View File

@ -670,13 +670,13 @@ class H5PStorage {
public function savePackage($contentId, $contentMainId = NULL) { public function savePackage($contentId, $contentMainId = NULL) {
foreach ($this->h5pC->librariesJsonData as $key => &$library) { foreach ($this->h5pC->librariesJsonData as $key => &$library) {
$libraryId = $this->h5pF->getLibraryId($key, $library['majorVersion'], $library['minorVersion']); $library_id = $this->h5pF->getLibraryId($key, $library['majorVersion'], $library['minorVersion']);
if (!$libraryId) { if (!$library_id) {
$new = TRUE; $new = TRUE;
} }
elseif ($this->h5pF->isPatchedLibrary($library)) { elseif ($this->h5pF->isPatchedLibrary($library)) {
$new = FALSE; $new = FALSE;
$library['libraryId'] = $libraryId; $library['id'] = $library_id;
} }
else { else {
// We already have the same or a newer version of this library // We already have the same or a newer version of this library
@ -685,20 +685,20 @@ class H5PStorage {
$this->h5pF->saveLibraryData($library, $new); $this->h5pF->saveLibraryData($library, $new);
$current_path = $this->h5pF->getUploadedH5pFolderPath() . DIRECTORY_SEPARATOR . $key; $current_path = $this->h5pF->getUploadedH5pFolderPath() . DIRECTORY_SEPARATOR . $key;
$destination_path = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . $library['libraryId']; $destination_path = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . $library['id'];
$this->h5pC->delTree($destination_path); $this->h5pC->delTree($destination_path);
rename($current_path, $destination_path); rename($current_path, $destination_path);
} }
foreach ($this->h5pC->librariesJsonData as $key => &$library) { foreach ($this->h5pC->librariesJsonData as $key => &$library) {
// All libraries have been saved, we now save all the dependencies // All libraries have been saved, we now save all the dependencies
if (isset($library['preloadedDependencies'])) { if (isset($library['preloadedDependencies'])) {
$this->h5pF->saveLibraryDependencies($library['libraryId'], $library['preloadedDependencies'], 'preloaded'); $this->h5pF->saveLibraryDependencies($library['id'], $library['preloadedDependencies'], 'preloaded');
} }
if (isset($library['dynamicDependencies'])) { if (isset($library['dynamicDependencies'])) {
$this->h5pF->saveLibraryDependencies($library['libraryId'], $library['dynamicDependencies'], 'dynamic'); $this->h5pF->saveLibraryDependencies($library['id'], $library['dynamicDependencies'], 'dynamic');
} }
if (isset($library['editorDependencies'])) { if (isset($library['editorDependencies'])) {
$this->h5pF->saveLibraryDependencies($library['libraryId'], $library['editorDependencies'], 'editor'); $this->h5pF->saveLibraryDependencies($library['id'], $library['editorDependencies'], 'editor');
} }
} }
$current_path = $this->h5pF->getUploadedH5pFolderPath() . DIRECTORY_SEPARATOR . 'content'; $current_path = $this->h5pF->getUploadedH5pFolderPath() . DIRECTORY_SEPARATOR . 'content';
@ -711,8 +711,8 @@ class H5PStorage {
$this->h5pC->delTree($this->h5pF->getUploadedH5pFolderPath()); $this->h5pC->delTree($this->h5pF->getUploadedH5pFolderPath());
$contentJson = file_get_contents($destination_path . DIRECTORY_SEPARATOR . 'content.json'); $contentJson = file_get_contents($destination_path . DIRECTORY_SEPARATOR . 'content.json');
$mainLibraryId = $librariesInUse[$this->h5pC->mainJsonData['mainLibrary']]['library']['libraryId']; $library_id = $librariesInUse[$this->h5pC->mainJsonData['mainLibrary']]['library']['id'];
$this->h5pF->saveContentData($contentId, $contentJson, $this->h5pC->mainJsonData, $mainLibraryId, $contentMainId); $this->h5pF->saveContentData($contentId, $contentJson, $this->h5pC->mainJsonData, $library_id, $contentMainId);
} }
public function deletePackage($contentId) { public function deletePackage($contentId) {