You are here

function authcache_admin_pagecaching_submit in Authenticated User Page Caching (Authcache) 7.2

Same name and namespace in other branches
  1. 6 authcache.admin.inc \authcache_admin_pagecaching_submit()
  2. 7 authcache.admin.inc \authcache_admin_pagecaching_submit()

Page caching rules form submit.

File

./authcache.admin.inc, line 254
Admin forms and pages.

Code

function authcache_admin_pagecaching_submit($form, &$form_state) {
  $pagecaching = array();
  foreach ($form_state['values']['ajax'] as $key => $ray) {
    $values = $ray['fieldset'];
    if ($values['pages']) {
      $pagecaching[] = $values;
    }
    $effective_roles = authcache_get_role_restrict_roles($values['roles']);
    if (empty($effective_roles)) {
      drupal_set_message(t('Ruleset #%key is disabled since no roles are associated with it.', array(
        '%key' => $key + 1,
      )), 'warning');
    }
  }
  if (!empty($pagecaching)) {
    variable_set('authcache_pagecaching', $pagecaching);
  }
  else {
    variable_del('authcache_pagecaching');
  }
  drupal_set_message(t('Your page caching settings have been saved.'));
  cache_clear_all();
  drupal_set_message(t('Cached pages cleared.'));
}