HFP-2323 Fix clearing all the content caches at the same time

pull/65/head
Frode Petterson 2019-07-12 16:39:46 +02:00
parent 9e749eda92
commit 03794f36dd
1 changed files with 7 additions and 5 deletions

View File

@ -518,12 +518,12 @@ interface H5PFrameworkInterface {
/** /**
* Will clear filtered params for all the content that uses the specified * 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. * 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 * 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. // Go through the libraries again to save dependencies.
$library_ids = [];
foreach ($this->h5pC->librariesJsonData as &$library) { foreach ($this->h5pC->librariesJsonData as &$library) {
if (!$library['saveDependencies']) { if (!$library['saveDependencies']) {
continue; continue;
@ -1644,9 +1645,10 @@ class H5PStorage {
$this->h5pF->saveLibraryDependencies($library['libraryId'], $library['editorDependencies'], 'editor'); $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. $library_ids[] = $library['libraryId'];
$this->h5pF->clearFilteredParameters($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. // Tell the user what we've done.
if ($newOnes && $oldOnes) { if ($newOnes && $oldOnes) {