diff --git a/features.export.inc b/features.export.inc index d35317e..95fcc82 100644 --- a/features.export.inc +++ b/features.export.inc @@ -45,11 +45,8 @@ function features_populate($info, $module_name) { * @return fully populated $export array. */ function _features_populate($pipe, &$export, $module_name = '', $reset = FALSE) { - static $processed = array(); + $processed = drupal_static(__FUNCTION__, array(), $reset); features_include(); - if ($reset) { - $processed = array(); - } foreach ($pipe as $component => $data) { // Convert already defined items to dependencies. // _features_resolve_dependencies($data, $export, $module_name, $component); @@ -371,10 +368,7 @@ function features_export_render($export, $module_name, $reset = FALSE) { * Detect differences between DB and code components of a feature. */ function features_detect_overrides($module) { - static $cache; - if (!isset($cache)) { - $cache = array(); - } + $cache = drupal_static(__FUNCTION__, array()); if (!isset($cache[$module->name])) { // Rebuild feature from .info file description and prepare an export from current DB state. $export = features_populate($module->info, $module->name); @@ -685,10 +679,7 @@ function features_semaphore($op, $component) { * Get normal objects for a given module/component pair. */ function features_get_normal($component, $module_name, $reset = FALSE) { - static $cache; - if (!isset($cache) || $reset) { - $cache = array(); - } + $cache = drupal_static(__FUNCTION__, array(), $reset); if (!isset($cache[$module_name][$component])) { features_include(); $code = NULL; @@ -718,7 +709,7 @@ function features_get_normal($component, $module_name, $reset = FALSE) { * Get defaults for a given module/component pair. */ function features_get_default($component, $module_name = NULL, $alter = TRUE, $reset = FALSE) { - static $cache = array(); + $cache = drupal_static(__FUNCTION__, array()); $alter = !empty($alter); // ensure $alter is a true/false boolean features_include(); features_include_defaults($component); @@ -792,7 +783,7 @@ function features_get_default($component, $module_name = NULL, $alter = TRUE, $r * Get a map of components to their providing modules. */ function features_get_default_map($component, $attribute = NULL, $callback = NULL, $reset = FALSE) { - static $map = array(); + $map = drupal_static(__FUNCTION__, array()); global $features_ignore_conflicts; if ($features_ignore_conflicts) { @@ -838,10 +829,7 @@ function features_get_default_map($component, $attribute = NULL, $callback = NUL * Retrieve an array of features/components and their current states. */ function features_get_component_states($features = array(), $rebuild_only = TRUE, $reset = FALSE) { - static $cache; - if (!isset($cache) || $reset) { - $cache = array(); - } + $cache = drupal_static(__FUNCTION__, array(), $reset); $features = !empty($features) ? $features : array_keys(features_get_features());