function ultimate_cron_update_7103 in Ultimate Cron 7.2
Same name and namespace in other branches
- 7 ultimate_cron.install \ultimate_cron_update_7103()
Merge configuration.
Merge ultimate_cron_function and ultimate_cron_configuration into ultimate_cron.
File
- ./
ultimate_cron.install, line 416 - Installation file for Ultimate Cron.
Code
function ultimate_cron_update_7103() {
if (!db_table_exists('ultimate_cron')) {
// 'ultimate_cron' doesn't exist, so this update has never run and was
// never run when it was previously called ultimate_cron_update_6002() or
// ultimate_cron_update_7002() - hence, it needs to be run.
// NOTE - Include the schema here, as referring to ultimate_cron_schema()
// will cause errors in ultimate_cron_update_7105().
$schema = array();
$schema['ultimate_cron'] = array(
'description' => 'Cron job function list',
'export' => array(
'key' => 'function',
'key name' => 'Function name',
'primary key' => 'fid',
'identifier' => 'function',
'default hook' => 'default_ultimate_cron_function',
'api' => array(
'owner' => 'ultimate_cron',
'api' => 'default_ultimate_cron_functions',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'fid' => array(
'description' => 'Function ID',
'type' => 'serial',
'size' => 'normal',
'not null' => TRUE,
'no export' => TRUE,
),
'function' => array(
'description' => 'Function name',
'type' => 'varchar',
'length' => 127,
'not null' => TRUE,
),
'settings' => array(
'description' => 'Settings',
'type' => 'text',
'serialize' => TRUE,
'not null' => FALSE,
),
),
'primary key' => array(
'fid',
),
'unique key' => array(
'function',
),
);
db_create_table('ultimate_cron', $schema['ultimate_cron']);
db_query("INSERT INTO {ultimate_cron} SELECT f.fid, f.function, c.configuration AS settings FROM ultimate_cron_function f LEFT JOIN {ultimate_cron_configuration} c ON f.fid = c.fid");
db_drop_table('ultimate_cron_function');
db_drop_table('ultimate_cron_configuration');
}
}