You are here

function authcache_requirements in Authenticated User Page Caching (Authcache) 7

Same name and namespace in other branches
  1. 7.2 authcache.install \authcache_requirements()

Implements hook_requirements().

File

./authcache.install, line 31
Install, update and uninstall functions for the authcache module.

Code

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

  // Ensure translations don't break during installation.
  $t = get_t();

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