updated rules

This commit is contained in:
2020-06-23 12:29:12 +02:00
parent 35b78db5c0
commit da7085e201
72 changed files with 2402 additions and 1060 deletions
@@ -1,7 +1,8 @@
<?php
/**
* @file Rules - Installation file.
* @file
* Rules - Installation file.
*/
/**
@@ -18,7 +19,7 @@ function rules_enable() {
function rules_install() {
module_load_include('inc', 'rules', 'modules/events');
// Set the modules' weight to 20, see
// http://drupal.org/node/445084#comment-1533280 for the reasoning.
// https://www.drupal.org/node/445084#comment-1533280 for the reasoning.
db_query("UPDATE {system} SET weight = 20 WHERE name = 'rules'");
}
@@ -26,8 +27,22 @@ function rules_install() {
* Implements hook_uninstall().
*/
function rules_uninstall() {
variable_del('rules_event_whitelist');
variable_del('rules_debug');
variable_del('rules_debug_log');
variable_del('rules_log_errors');
variable_del('rules_log_level');
variable_del('rules_clean_path');
variable_del('rules_path_cleaning_callback');
variable_del('rules_path_lower_case');
variable_del('rules_path_replacement_char');
variable_del('rules_path_transliteration');
// Delete all the debug region variables and then clear the variables cache.
db_delete('variable')
->condition('name', 'rules_debug_region_%', 'LIKE')
->execute();
cache_clear_all('variables', 'cache_bootstrap');
}
/**
@@ -54,7 +69,7 @@ function rules_schema() {
'description' => 'The label of the configuration.',
'default' => 'unlabeled',
),
'plugin' => array(
'plugin' => array(
'type' => 'varchar',
'length' => 127,
'not null' => TRUE,
@@ -122,7 +137,7 @@ function rules_schema() {
'name' => array('name'),
),
'indexes' => array(
'plugin' => array('plugin'),
'plugin' => array('plugin', 'active'),
),
);
$schema['rules_trigger'] = array(
@@ -222,7 +237,7 @@ function rules_update_7200() {
'description' => 'The label of the configuration.',
'default' => 'unlabeled',
),
'plugin' => array(
'plugin' => array(
'type' => 'varchar',
'length' => 127,
'not null' => TRUE,
@@ -492,7 +507,7 @@ function rules_update_7212() {
* Recover the "owner" property for broken configurations.
*/
function rules_update_7213() {
$rows= db_select('rules_config', 'c')
$rows = db_select('rules_config', 'c')
->fields('c')
->condition('status', ENTITY_OVERRIDDEN)
->condition('owner', 'rules', '<>')
@@ -513,6 +528,12 @@ function rules_update_7213() {
* Switch out the rules_event_whitelist variable for a cache equivalent.
*/
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.
@@ -525,4 +546,18 @@ function rules_update_7214() {
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'));
}
}
/**
* Add an index for retrieving active config of a certain plugin.
*/
function rules_update_7215() {
if (db_index_exists('rules_config', 'plugin')) {
db_drop_index('rules_config', 'plugin');
}
db_add_index('rules_config', 'plugin', array('plugin', 'active'));
}