You are here

public function UltimateCronCacheLogger::load in Ultimate Cron 7.2

Load log entry.

Overrides UltimateCronLogger::load

1 call to UltimateCronCacheLogger::load()
UltimateCronCacheLogger::getLogEntries in plugins/ultimate_cron/logger/cache.class.php
Get log entries.

File

plugins/ultimate_cron/logger/cache.class.php, line 26
Cache logger for Ultimate Cron.

Class

UltimateCronCacheLogger
Class for using cache as storage for logs.

Code

public function load($name, $lock_id = NULL, $log_types = array(
  ULTIMATE_CRON_LOG_TYPE_NORMAL,
)) {
  $log_entry = new $this->log_entry_class($name, $this);
  $job = _ultimate_cron_job_load($name);
  $settings = $job
    ->getSettings('logger');
  if (!$lock_id) {
    $cache = cache_get('uc-name:' . $name, $settings['bin']);
    if (empty($cache) || empty($cache->data)) {
      return $log_entry;
    }
    $lock_id = $cache->data;
  }
  $cache = cache_get('uc-lid:' . $lock_id, $settings['bin']);
  if (!empty($cache->data)) {
    $log_entry
      ->setData((array) $cache->data);
    $log_entry->finished = TRUE;
  }
  return $log_entry;
}