function rules_admin_update_6001 in Rules 6
Update 6001 Example rules are now added by hook_install() instead of using default rules.
If the default rules have been altered, mark them as custom now. Else the examples would be gone, so we add them now.
File
- rules_admin/
rules_admin.install, line 73 - Rules Admin UI - Installation file.
Code
function rules_admin_update_6001() {
$rules = rules_get_configured_items('rules');
if (isset($rules['rules_default_rule_1']['#status']) && $rules['rules_default_rule_1']['#status'] == 'altered') {
$rules['rules_default_rule_1']['#status'] = 'custom';
rules_item_delete('rules', 'rules_default_rule_1');
rules_item_save('rules', 'rules_example_1', $rules['rules_default_rule_1']);
}
elseif (!isset($rules['rules_example_1'])) {
_rules_admin_install_example_rules();
}
$sets = rules_get_configured_items('rule_sets');
if (isset($sets['rules_set_1']) && $sets['rules_set_1']['status'] == 'altered') {
$sets['rules_set_1']['status'] = 'custom';
rules_item_save('rule_sets', 'rules_set_1', $sets['rules_set_1']);
}
elseif (!isset($sets['rules_set_1'])) {
_rules_admin_install_example_rule_sets();
}
rules_clear_cache();
return array();
}