You are here

function elysia_cron_get in Elysia Cron 6.2

Same name and namespace in other branches
  1. 5.2 elysia_cron.module \elysia_cron_get()
  2. 5 elysia_cron.module \elysia_cron_get()
  3. 6 elysia_cron.module \elysia_cron_get()
  4. 7.2 elysia_cron.module \elysia_cron_get()
  5. 7 elysia_cron.module \elysia_cron_get()
15 calls to elysia_cron_get()
elysia_cron_get_channel_abort_count in ./elysia_cron.module
elysia_cron_get_channel_last_aborted in ./elysia_cron.module
elysia_cron_get_channel_last_abort_function in ./elysia_cron.module
elysia_cron_get_channel_last_run in ./elysia_cron.module
elysia_cron_get_channel_rule in ./elysia_cron.module

... See full list

File

./elysia_cron.module, line 419

Code

function elysia_cron_get($name, $channel = false, $key = false, $default = false, $refresh = false) {
  global $elysia_cron_db_cache;
  static $elysia_cron_defaults;
  if (!isset($elysia_cron_defaults)) {
    $elysia_cron_defaults = function_exists('elysia_cron_get_ctools_defaults') ? elysia_cron_get_ctools_defaults() : array();
  }
  if ($channel) {
    $name = ':' . $name;
  }
  if ($refresh || !isset($elysia_cron_db_cache[$name])) {
    if (EC_DRUPAL_VERSION >= 7) {
      $elysia_cron_db_cache[$name] = db_query("select " . implode(", ", $GLOBALS['_ec_columns']) . " from {elysia_cron} where name = :name", array(
        ':name' => $name,
      ))
        ->fetchAssoc();
    }
    else {
      $elysia_cron_db_cache[$name] = db_fetch_array(db_query("select " . implode(", ", $GLOBALS['_ec_columns']) . " from {elysia_cron} where name = '%s'", $name));
    }
    if (!$elysia_cron_db_cache[$name] && isset($elysia_cron_defaults[$name])) {
      $elysia_cron_db_cache[$name] = (array) $elysia_cron_defaults[$name];
    }
    elseif ($elysia_cron_db_cache[$name] && isset($elysia_cron_defaults[$name])) {
      foreach ($elysia_cron_defaults[$name] as $k => $v) {
        if (!isset($elysia_cron_db_cache[$name][$k]) || is_null($elysia_cron_db_cache[$name][$k])) {
          $elysia_cron_db_cache[$name][$k] = $v;
        }
      }
    }
  }
  return !$elysia_cron_db_cache[$name] || !isset($elysia_cron_db_cache[$name][$key]) || is_null($elysia_cron_db_cache[$name][$key]) ? $default : $elysia_cron_db_cache[$name][$key];
}