You are here

private function H5PEditorAjaxImport::isContentTypeCacheUpdated in Opigno module 3.x

Same name and namespace in other branches
  1. 8 src/H5PImportClasses/H5PEditorAjaxImport.php \Drupal\opigno_module\H5PImportClasses\H5PEditorAjaxImport::isContentTypeCacheUpdated()

Checks if Content Type Cache is up to date. Immediately tries to fetch a new Content Type Cache if it is outdated. Sets error message if fetching new Content Type Cache fails.

Return value

bool

1 call to H5PEditorAjaxImport::isContentTypeCacheUpdated()
H5PEditorAjaxImport::h5pLibariesList in src/H5PImportClasses/H5PEditorAjaxImport.php
Gets the list of libraries.

File

src/H5PImportClasses/H5PEditorAjaxImport.php, line 38

Class

H5PEditorAjaxImport
Class H5PEditorAjaxMigrate.

Namespace

Drupal\opigno_module\H5PImportClasses

Code

private function isContentTypeCacheUpdated() {

  // Update content type cache if enabled and too old
  $ct_cache_last_update = $this->core->h5pF
    ->getOption('content_type_cache_updated_at', 0);
  $outdated_cache = $ct_cache_last_update + 60 * 60 * 24 * 7;

  // 1 week
  if (time() > $outdated_cache) {
    $success = $this->core
      ->updateContentTypeCache();
    if (!$success) {
      return false;
    }
  }
  return true;
}