You are here

function authcache_builtin_requirements in Authenticated User Page Caching (Authcache) 7.2

Implements hook_requirements().

File

modules/authcache_builtin/authcache_builtin.install, line 10
Install, update and uninstall functions for the Authcache Bultin module.

Code

function authcache_builtin_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break during installation.
  $t = get_t();
  $requirements['authcache_builtin'] = array(
    'title' => $t('Authcache builtin cache backend'),
  );

  // Retrieve the name of the cache class used for the cache_page bin.
  $page_cache_class = get_class(_cache_get_object('cache_page'));
  if (_authcache_builtin_backendstatus()) {
    $requirements['authcache_builtin']['value'] = $t('Using %class as cache backend', array(
      '%class' => $page_cache_class,
    ));
  }
  else {
    $requirements['authcache_builtin']['value'] = $t('Either authcache.inc is missing or authcache_builtin.cache.inc is not the last entry in cache_backends variable.');
    $requirements['authcache_builtin']['description'] = $t('Your settings.php file must be modified to enable Authcache builtin cache backend. See <a href="@url">README.txt</a>.', array(
      '@url' => base_path() . drupal_get_path('module', 'authcache_builtin') . '/README.txt',
    ));
    $requirements['authcache_builtin']['severity'] = $phase === 'runtime' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING;
  }
  return $requirements;
}