You are here

function cache_actions_rules_cache_settings_form_submit in Cache Actions 7.2

Saves the cache settings.

Parameters

array $values: The values to store.

1 string reference to 'cache_actions_rules_cache_settings_form_submit'
rules.inc in plugins/cache/rules.inc
Provides a simple time-based caching option for panel panes.

File

plugins/cache/rules.inc, line 262
Provides a simple time-based caching option for panel panes.

Code

function cache_actions_rules_cache_settings_form_submit(&$values) {
  $values['cache_key'] = $values['advanced']['cache_key'];
  $values['substitute'] = $values['advanced']['substitute'];

  // Add an indicator that this is stored with the new caching mechanism.
  $values['new'] = TRUE;

  // Store cache key updates in a variable,
  // so that we can update any rules that may be using the old cache key.
  if (!empty($values['old_cache_key']) && $values['old_cache_key'] != $values['cache_key']) {
    $cache_actions_updated_panes = variable_get('cache_actions_updated_panes', array());

    // Store the oldest cache key for this session under the newest key.
    if (isset($cache_actions_updated_panes[$values['display_cache_key']][$values['old_cache_key']])) {
      $cache_actions_updated_panes[$values['display_cache_key']][$values['cache_key']] = $cache_actions_updated_panes[$values['display_cache_key']][$values['old_cache_key']];
      unset($cache_actions_updated_panes[$values['display_cache_key']][$values['old_cache_key']]);
    }
    else {
      $cache_actions_updated_panes[$values['display_cache_key']][$values['cache_key']] = $values['old_cache_key'];
    }
    variable_set('cache_actions_updated_panes', $cache_actions_updated_panes);
  }
  unset($values['advanced']['cache_key'], $values['advanced']['substitute'], $values['old_cache_key'], $values['display_cache_key']);
}