function rules_update_7214

Switch out the rules_event_whitelist variable for a cache equivalent.

File

./rules.install, line 530

Code

function rules_update_7214() {
    // Enable Rules if currently disabled so that this update won't fail.
    $disable_rules = FALSE;
    if (!module_exists('rules')) {
        module_enable(array(
            'rules',
        ));
        $disable_rules = TRUE;
    }
    // Set new event_whitelist cache cid.
    rules_set_cache('rules_event_whitelist', variable_get('rules_event_whitelist', array()));
    // Delete old conf variable.
    variable_del('rules_event_whitelist');
    // Avoid any missing class errors.
    registry_rebuild();
    // Clear and rebuild Rules caches.
    // See: rules_admin_settings_cache_rebuild_submit.
    rules_clear_cache();
    rules_get_cache();
    _rules_rebuild_component_cache();
    RulesEventSet::rebuildEventCache();
    // Disable Rules again if it was disabled before this update started.
    if ($disable_rules) {
        module_disable(array(
            'rules',
        ));
    }
}