parent
4d7dccad3d
commit
d5be0158a4
|
@ -3406,26 +3406,26 @@ class H5PCore {
|
||||||
*
|
*
|
||||||
* @return JsonSerializable|string
|
* @return JsonSerializable|string
|
||||||
*/
|
*/
|
||||||
public function getUpdatedContentHubMetadataCache() {
|
public function getUpdatedContentHubMetadataCache($lang = 'en') {
|
||||||
$lastUpdate = $this->h5pF->getContentHubMetadataChecked($this->language);
|
$lastUpdate = $this->h5pF->getContentHubMetadataChecked($lang);
|
||||||
if (!$lastUpdate) {
|
if (!$lastUpdate) {
|
||||||
return $this->updateContentHubMetadataCache($this->language);
|
return $this->updateContentHubMetadataCache($lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastUpdate = new DateTime($lastUpdate);
|
$lastUpdate = new DateTime($lastUpdate);
|
||||||
$expirationTime = $lastUpdate->getTimestamp() + (60 * 60 * 24); // Check once per day
|
$expirationTime = $lastUpdate->getTimestamp() + (60 * 60 * 24); // Check once per day
|
||||||
if (time() > $expirationTime) {
|
if (time() > $expirationTime) {
|
||||||
$update = $this->updateContentHubMetadataCache($this->language);
|
$update = $this->updateContentHubMetadataCache($lang);
|
||||||
if (!empty($update)) {
|
if (!empty($update)) {
|
||||||
return $update;
|
return $update;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$storedCache = $this->h5pF->getContentHubMetadataCache($this->language);
|
$storedCache = $this->h5pF->getContentHubMetadataCache($lang);
|
||||||
if (!$storedCache) {
|
if (!$storedCache) {
|
||||||
// We don't have the value stored for some reason, reset last update and re-fetch
|
// We don't have the value stored for some reason, reset last update and re-fetch
|
||||||
$this->h5pF->setContentHubMetadataChecked(null, $this->language);
|
$this->h5pF->setContentHubMetadataChecked(null, $lang);
|
||||||
return $this->updateContentHubMetadataCache($this->language);
|
return $this->updateContentHubMetadataCache($lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $storedCache;
|
return $storedCache;
|
||||||
|
|
Loading…
Reference in New Issue