From d1dd47be6f93424c03ecfe6a79c51aa212dbd1ce Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Tue, 5 Feb 2019 13:15:50 +0100 Subject: [PATCH] JI-942 Fix auto content upgrade to work with Drupal module --- ...ntent-outdated-library-exception.class.php | 3 --- h5p.classes.php | 21 +++---------------- styles/h5p-admin.css | 3 +++ 3 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 exceptions/h5p-save-content-outdated-library-exception.class.php diff --git a/exceptions/h5p-save-content-outdated-library-exception.class.php b/exceptions/h5p-save-content-outdated-library-exception.class.php deleted file mode 100644 index dab8ed2..0000000 --- a/exceptions/h5p-save-content-outdated-library-exception.class.php +++ /dev/null @@ -1,3 +0,0 @@ -h5pC->saveContent($content, $contentMainId); + $this->contentId = $content['id']; try { - // Store content in database - $content['id'] = $this->h5pC->saveContent($content, $contentMainId); - $this->contentId = $content['id']; - // Save content folder contents $this->h5pC->fs->saveContent($current_path, $content); } catch (Exception $e) { - if ($e instanceof H5PSaveContentOutdatedLibraryException) { - $message = $this->h5pF->t("You're trying to upload content of an older version of H5P. Please upgrade the content on the server it originated from and try to upload again or turn on the H5P Hub to have this server upgrade it for your automaticall."); - } - else { - $message = $e->getMessage(); - } - $this->h5pF->setErrorMessage($message, 'save-content-failed'); + $this->h5pF->setErrorMessage($e->getMessage(), 'save-content-failed'); } // Remove temp content folder @@ -1963,13 +1955,6 @@ class H5PCore { * @return int Content ID */ public function saveContent($content, $contentMainId = NULL) { - - // Check that this is the latest version of the content type we have - if ($this->h5pF->libraryHasUpgrade($content['library'])) { - // We do not allow storing old content due to security concerns - throw new \H5PSaveContentOutdatedLibraryException($this->h5pF->t('Something unexpected happened. We were unable to save this content.')); - } - if (isset($content['id'])) { $this->h5pF->updateContent($content, $contentMainId); } diff --git a/styles/h5p-admin.css b/styles/h5p-admin.css index 100dfea..372da79 100644 --- a/styles/h5p-admin.css +++ b/styles/h5p-admin.css @@ -339,3 +339,6 @@ button.h5p-admin.disabled:hover { .h5p-data-view .h5p-facet-tag > span:active { color: #d20000; } +.content-upgrade-log { + color: red; +}