Commit 33c688c6 authored by Mike Potter's avatar Mike Potter Committed by Joseph Olstad
Browse files

Issue #1325288 by joelpittet, mpotter, temkin, scor: Use regular cache table for features_codecache

parent f260688f
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -672,7 +672,10 @@ function features_get_storage($module_name) {
function features_get_signature($state = 'default', $module_name, $component, $reset = FALSE) {
  switch ($state) {
    case 'cache':
      $codecache = variable_get('features_codecache', array());
      $cache = cache_get('features_codecache', 'cache_featurestate');
      if (!empty($cache->data)) {
        $codecache = $cache->data;
      }
      return isset($codecache[$module_name][$component]) ? $codecache[$module_name][$component] : FALSE;
    case 'default':
      $objects = features_get_default($component, $module_name, TRUE, $reset);
@@ -692,10 +695,13 @@ function features_get_signature($state = 'default', $module_name, $component, $r
 * Set the signature of a module/component pair in the codecache.
 */
function features_set_signature($module, $component, $signature = NULL) {
  $var_codecache = variable_get('features_codecache', array());
  $cache = cache_get('features_codecache', 'cache_featurestate');
  if (!empty($cache->data)) {
    $codecache = $cache->data;
  }
  $signature = isset($signature) ? $signature : features_get_signature('default', $module, $component, TRUE);
  $var_codecache[$module][$component] = $signature;
  variable_set('features_codecache', $var_codecache);
  $codecache[$module][$component] = $signature;
  cache_set('features_codecache', $codecache, 'cache_featurestate');
}

/**
+13 −0
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@
function features_schema() {
  $schema['cache_features'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_features']['description'] = 'Cache table for features to store module info.';
  $schema['cache_featurestate'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_featurestate']['description'] = 'Table for features to store persistent state info.';
  return $schema;
}

@@ -149,3 +151,14 @@ function features_update_7200() {
    db_create_table('cache_features', $schema);
  }
}

/**
 * Add {cache_featurestate} table.
 */
function features_update_7201() {
  if (!db_table_exists('cache_featurestate')) {
    variable_del('features_codecache');
    $schema = drupal_get_schema_unprocessed('system', 'cache');
    db_create_table('cache_featurestate', $schema);
  }
}