You are here

function authcache_enable in Authenticated User Page Caching (Authcache) 6

Same name and namespace in other branches
  1. 7 authcache.install \authcache_enable()

Implements hook_enable().

File

./authcache.install, line 6

Code

function authcache_enable() {
  global $user;

  // Did admin follow install instructions?
  if (substr(variable_get('cache_inc', FALSE), -13) != 'authcache.inc') {
    drupal_set_message(st('Your settings.php file must be modified to enable Authcache ($conf[\'cache_inc\']). See <a href="@url">README.txt</a>.', array(
      '@url' => base_path() . drupal_get_path('module', 'authcache') . '/README.txt',
    )), 'error');
  }
  drupal_set_message(st('Authcache has been enabled. Please configure your caching settings under <a href="@url">Site Configuration -> Performance -> Authcache</a>.', array(
    '@url' => base_path() . 'admin/settings/performance/authcache',
  )), 'warning');

  // Set authcache cookie for user so they don't receive cached anon pages.
  authcache_user('login', $user, $user);
}