You are here

function authcache_enum_requirements in Authenticated User Page Caching (Authcache) 7.2

Implements hook_requirements().

File

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

Code

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

  // Ensure translations don't break during installation.
  $t = get_t();
  if (variable_get('authcache_su', 0)) {
    $requirements['authcache_enum_su'] = array(
      'title' => $t('Authcache key enumeration'),
      'value' => $t('Conflicting setting detected'),
      'description' => $t('Authcache Enum conflicts with the setting %option. Please disable it on the <a href="!link">Authcache configuration</a> page.', array(
        '%option' => $t('Allow caching for superuser (uid = 1)'),
        '!link' => url('admin/config/system/authcache'),
      )),
      'severity' => $phase === 'runtime' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING,
    );
  }
  $func = variable_get('authcache_enum_role_combine', '_authcache_enum_default_role_combine');
  $roles = variable_get('authcache_roles', array());
  $role_limit = variable_get('authcache_enum_role_limit', 10);
  if ($func === '_authcache_enum_default_role_combine' && count($roles) > $role_limit) {
    $requirements['authcache_enum_role_limit'] = array(
      'title' => $t('Authcache key enumeration'),
      'value' => $t('Performance warning'),
      'description' => $t('Authcache Enum computes all authcache keys which are theoretically possible using a brute-force method (cartesian product). This may lead to severe performance degradation if more than @role_limit roles are enabled. As a result, certain operations like saving content can get very slow if the <em>Cache Expiration</em> module is also in use.', array(
        '@role_limit' => $role_limit,
      )),
      'severity' => $phase === 'runtime' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING,
    );
  }
  return $requirements;
}