updated rules

This commit is contained in:
2021-07-12 09:49:00 +02:00
parent 7b1e954f7f
commit fd5d68d5e9
75 changed files with 5254 additions and 1335 deletions

View File

@@ -30,11 +30,12 @@ function rules_scheduler_schema() {
'type' => 'int',
'not null' => TRUE,
),
'state' => array(
'type' => 'text',
'data' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
'serialize' => TRUE,
'description' => 'The whole, serialized evaluation state.',
'description' => 'The whole, serialized evaluation data.',
),
'identifier' => array(
'type' => 'varchar',
@@ -43,6 +44,12 @@ function rules_scheduler_schema() {
'not null' => FALSE,
'description' => 'The user defined string identifying this task.',
),
'handler' => array(
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
'description' => 'The fully-qualified class name of the queue item handler.',
),
),
'primary key' => array('tid'),
'indexes' => array(
@@ -55,6 +62,24 @@ function rules_scheduler_schema() {
return $schema;
}
/**
* Implements hook_install().
*/
function rules_scheduler_install() {
// Create the queue to hold scheduled tasks.
$queue = DrupalQueue::get('rules_scheduler_tasks', TRUE);
$queue->createQueue();
}
/**
* Implements hook_uninstall().
*/
function rules_scheduler_uninstall() {
// Clean up after ourselves by deleting the queue and all items in it.
$queue = DrupalQueue::get('rules_scheduler_tasks');
$queue->deleteQueue();
}
/**
* Upgrade from Rules scheduler 6.x-1.x to 7.x.
*/
@@ -84,11 +109,11 @@ function rules_scheduler_update_7200() {
'type' => 'int',
'not null' => TRUE,
),
'state' => array(
'data' => array(
'type' => 'text',
'not null' => FALSE,
'serialize' => TRUE,
'description' => 'The whole, serialized evaluation state.',
'description' => 'The whole, serialized evaluation data.',
),
'identifier' => array(
'type' => 'varchar',
@@ -122,6 +147,47 @@ function rules_scheduler_update_7202() {
db_add_unique_key('rules_scheduler', 'id', array('config', 'identifier'));
}
/**
* Add a database column for specifying a queue item handler.
*/
function rules_scheduler_update_7203() {
db_add_field('rules_scheduler', 'handler', array(
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
'description' => 'The fully-qualified class name of the queue item handler.',
));
}
/**
* Rename rules_scheduler.state into rules_scheduler.data.
*/
function rules_scheduler_update_7204() {
if (db_field_exists('rules_scheduler', 'state')) {
db_change_field('rules_scheduler', 'state', 'data', array(
'type' => 'text',
'not null' => FALSE,
'serialize' => TRUE,
'description' => 'The whole, serialized evaluation data.',
));
}
}
/**
* Use blob:big for rules_scheduler.data for compatibility with PostgreSQL.
*/
function rules_scheduler_update_7205() {
if (db_field_exists('rules_scheduler', 'data')) {
db_change_field('rules_scheduler', 'data', 'data', array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
'serialize' => TRUE,
'description' => 'The whole, serialized evaluation data.',
));
}
}
/**
* Rules upgrade callback for mapping the action name.
*/