You are here

authcache.install in Authenticated User Page Caching (Authcache) 6

Same filename and directory in other branches
  1. 7.2 authcache.install
  2. 7 authcache.install

File

authcache.install
View source
<?php

/**
 * Implements hook_enable().
 */
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);
}

/**
 * Implements hook_disable().
 */
function authcache_disable() {
}

/**
 * Implements hook_install().
 */
function authcache_install() {

  // Ensure that the module is loaded early in the bootstrap:
  db_query("UPDATE {system} SET weight = -90 WHERE name = '%s'", 'authcache');
}

/**
 * Implements hook_uninstall().
 */
function authcache_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE '%s_%%'", 'authcache');
  cache_clear_all('variables', 'cache');
}

Functions