You are here

function _ec_variable_del in Elysia Cron 6

Same name and namespace in other branches
  1. 5.2 elysia_cron.module \_ec_variable_del()
  2. 5 elysia_cron.module \_ec_variable_del()
  3. 6.2 elysia_cron.module \_ec_variable_del()
  4. 7.2 elysia_cron.module \_ec_variable_del()
  5. 7 elysia_cron.module \_ec_variable_del()

A substitute for variable_del 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_del()
elysia_cron_cron in ./elysia_cron.module
Hook cron is invoked only by standard drupal cron. It's used to replace drupal cron.
elysia_cron_execute_page in ./elysia_cron.admin.inc
elysia_cron_run in ./elysia_cron.module

File

./elysia_cron.module, line 286

Code

function _ec_variable_del($name) {
  global $_ec_variables, $_ec_variables_allowed;
  if (!in_array($name, $_ec_variables_allowed)) {
    _dco_watchdog('cron', 'Wrong variable passed to _ec_variable_del: !var', array(
      '!var' => $name,
    ), WATCHDOG_ERROR);
    return variable_del($name);
  }
  if (!is_array($_ec_variables)) {
    _ec_variable_init();
  }
  if (EC_DRUPAL_VERSION >= 7) {
    db_delete('variable')
      ->condition('name', $name)
      ->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_unlock_tables();
    }
    else {
      db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
    }
  }
  unset($_ec_variables[$name]);
}