From 03794f36dd49ea8212454e66cfe7515a3f694207 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Fri, 12 Jul 2019 16:39:46 +0200 Subject: [PATCH] HFP-2323 Fix clearing all the content caches at the same time --- h5p.classes.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index d9f1772..72c583a 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -518,12 +518,12 @@ interface H5PFrameworkInterface { /** * Will clear filtered params for all the content that uses the specified - * library. This means that the content dependencies will have to be rebuilt, + * libraries. This means that the content dependencies will have to be rebuilt, * and the parameters re-filtered. * - * @param int $library_id + * @param array $library_ids */ - public function clearFilteredParameters($library_id); + public function clearFilteredParameters($library_ids); /** * Get number of contents that has to get their content dependencies rebuilt @@ -1623,6 +1623,7 @@ class H5PStorage { } // Go through the libraries again to save dependencies. + $library_ids = []; foreach ($this->h5pC->librariesJsonData as &$library) { if (!$library['saveDependencies']) { continue; @@ -1644,9 +1645,10 @@ class H5PStorage { $this->h5pF->saveLibraryDependencies($library['libraryId'], $library['editorDependencies'], 'editor'); } - // Make sure libraries dependencies, parameter filtering and export files gets regenerated for all content who uses this library. - $this->h5pF->clearFilteredParameters($library['libraryId']); + $library_ids[] = $library['libraryId']; } + // Make sure libraries dependencies, parameter filtering and export files gets regenerated for all content who uses these libraries. + $this->h5pF->clearFilteredParameters($library_ids); // Tell the user what we've done. if ($newOnes && $oldOnes) {