function _ec_variable_set in Elysia Cron 6
Same name and namespace in other branches
- 5.2 elysia_cron.module \_ec_variable_set()
- 5 elysia_cron.module \_ec_variable_set()
- 6.2 elysia_cron.module \_ec_variable_set()
- 7.2 elysia_cron.module \_ec_variable_set()
- 7 elysia_cron.module \_ec_variable_set()
A substitute for variable_set to avoid cache management Use ONLY for variables setted during cron execution: elysia_cron_semaphore, elysia_cron_last_run, elysia_cron_last_context, cron_semaphore, cron_last WARN_UPGRADE
3 calls to _ec_variable_set()
- elysia_cron_completed in ./
elysia_cron.module - Successful termination (after all shutdown hooks invoked by cron functions).
- elysia_cron_run in ./
elysia_cron.module - elysia_cron_set_last_channel in ./
elysia_cron.module
File
- ./
elysia_cron.module, line 251
Code
function _ec_variable_set($name, $value) {
global $_ec_variables, $_ec_variables_allowed;
if (!in_array($name, $_ec_variables_allowed)) {
_dco_watchdog('cron', 'Wrong variable passed to _ec_variable_set: !var', array(
'!var' => $name,
), WATCHDOG_ERROR);
return variable_set($name, $value);
}
if (!is_array($_ec_variables)) {
_ec_variable_init();
}
if (EC_DRUPAL_VERSION >= 7) {
db_merge('variable')
->key(array(
'name' => $name,
))
->fields(array(
'value' => serialize($value),
))
->execute();
}
else {
if (!variable_get('elysia_cron_alternate_var_handler', false)) {
db_lock_table('variable');
db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
db_unlock_tables();
}
else {
db_query("REPLACE INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
}
}
$_ec_variables[$name] = $value;
}