Removed old caching system.
Use content variable for filtered parameters. Added getOption/setOption.d6
parent
39ea23b861
commit
a38a0f1253
|
@ -292,47 +292,53 @@ interface H5PFrameworkInterface {
|
|||
public function loadContentDependencies($id, $type = NULL);
|
||||
|
||||
/**
|
||||
* Get data from cache.
|
||||
* Get stored setting.
|
||||
*
|
||||
* @param string $group
|
||||
* @param string $key
|
||||
* @param string $name Identifier
|
||||
* @param string $default Optional
|
||||
* @return mixed data
|
||||
*/
|
||||
public function cacheGet($group, $key);
|
||||
public function getOption($name, $default = NULL);
|
||||
|
||||
/**
|
||||
* Store data in cache.
|
||||
* Stores the given setting.
|
||||
* For example when did we last check h5p.org for updates to our libraries.
|
||||
*
|
||||
* @param string $group
|
||||
* @param string $key
|
||||
* @param mixed $data
|
||||
* @param string $name Identifier
|
||||
* @param mixed $value Data
|
||||
*/
|
||||
public function cacheSet($group, $key, $data);
|
||||
public function setOption($name, $value);
|
||||
|
||||
/**
|
||||
* Delete data from cache.
|
||||
* This will set the filtered parameters for the given content.
|
||||
*
|
||||
* @param string $group
|
||||
* @param string $key
|
||||
* @param int $content_id
|
||||
* @param string $parameters filtered
|
||||
*/
|
||||
public function cacheDel($group, $key = NULL);
|
||||
public function setFilteredParameters($content_id, $parameters = '');
|
||||
|
||||
/**
|
||||
* Will invalidate the cache for the content that uses the specified library.
|
||||
* This means that the content dependencies has to be rebuilt, and the parameters refiltered.
|
||||
* Will clear filtered params for all the content that uses the specified
|
||||
* library. This means that the content dependencies will have to be rebuilt,
|
||||
* and the parameters refiltered.
|
||||
*
|
||||
* @param int $library_id
|
||||
*/
|
||||
public function invalidateContentCache($library_id);
|
||||
public function clearFilteredParameters($library_id);
|
||||
|
||||
/**
|
||||
* Get content without cache.
|
||||
* Get number of contents that has to get their content dependencies rebuilt
|
||||
* and parameters refiltered.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNotCached();
|
||||
public function getNumNotFiltered();
|
||||
|
||||
/**
|
||||
* Get number of contents using library as main library.
|
||||
*
|
||||
* @param int $library_id
|
||||
* @return int
|
||||
*/
|
||||
public function getNumContent($library_id);
|
||||
}
|
||||
|
@ -1103,7 +1109,7 @@ class H5PStorage {
|
|||
}
|
||||
|
||||
// Make sure libraries dependencies, parameter filtering and export files gets regenerated for all content who uses this library.
|
||||
$this->h5pF->invalidateContentCache($library['libraryId']);
|
||||
$this->h5pF->clearFilteredParameters($library['libraryId']);
|
||||
|
||||
$upgradedLibsCount++;
|
||||
}
|
||||
|
@ -1403,11 +1409,6 @@ class H5PCore {
|
|||
$content['id'] = $this->h5pF->insertContent($content, $contentMainId);
|
||||
}
|
||||
|
||||
if (!isset($content['filtered'])) {
|
||||
// TODO: Add filtered to all impl. and remove
|
||||
$this->h5pF->cacheDel('parameters', $content['id']);
|
||||
}
|
||||
|
||||
return $content['id'];
|
||||
}
|
||||
|
||||
|
@ -1455,16 +1456,8 @@ class H5PCore {
|
|||
* @return Object NULL on failure.
|
||||
*/
|
||||
public function filterParameters($content) {
|
||||
if (isset($content['filtered'])) {
|
||||
$params = ($content['filtered'] === '' ? NULL : $content['filtered']);
|
||||
}
|
||||
else {
|
||||
// TODO: Add filtered to all impl. and remove
|
||||
$params = $this->h5pF->cacheGet('parameters', $content['id']);
|
||||
}
|
||||
|
||||
if ($params !== NULL) {
|
||||
return $params;
|
||||
if (isset($content['filtered']) && $content['filtered'] !== '') {
|
||||
return $content['filtered'];
|
||||
}
|
||||
|
||||
// Validate and filter against main library semantics.
|
||||
|
@ -1491,7 +1484,7 @@ class H5PCore {
|
|||
}
|
||||
|
||||
// Cache.
|
||||
$this->h5pF->cacheSet('parameters', $content['id'], $params);
|
||||
$this->h5pF->setFilteredParameters($content['id'], $params);
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue