You are here

function _rules_rebuild_component_cache in Rules 7.2

Cache components to allow efficient usage via rules_invoke_component().

See also

rules_invoke_component()

rules_get_cache()

3 calls to _rules_rebuild_component_cache()
rules_admin_settings_cache_rebuild_submit in rules_admin/rules_admin.inc
Form submit callback: Rebuild the Rules' cache.
rules_get_cache in ./rules.module
Gets a rules cache entry.
rules_update_7214 in ./rules.install
Switch out the rules_event_whitelist variable for a cache equivalent.

File

./rules.module, line 458
Rules engine module.

Code

function _rules_rebuild_component_cache() {
  $components = rules_get_components();
  foreach ($components as $id => $component) {

    // If a component is marked as dirty, check if this still applies.
    if ($component->dirty) {
      rules_config_update_dirty_flag($component);
    }
    if (!$component->dirty) {

      // Clone the component to avoid modules getting the to be cached
      // version from the static loading cache.
      $component = clone $component;
      $component
        ->optimize();

      // Allow modules to alter the cached component.
      drupal_alter('rules_component', $component->plugin, $component);
      rules_set_cache('comp_' . $component->name, $component);
    }
  }
}