public function DatabaseLogger::load in Ultimate Cron 8.2
Load a log.
Parameters
string $name: Name of log.
string $lock_id: Specific lock id.
Return value
\Drupal\ultimate_cron\Logger\LogEntry Log entry
Overrides LoggerInterface::load
File
- src/
Plugin/ ultimate_cron/ Logger/ DatabaseLogger.php, line 219
Class
- DatabaseLogger
- Database logger.
Namespace
Drupal\ultimate_cron\Plugin\ultimate_cron\LoggerCode
public function load($name, $lock_id = NULL, array $log_types = [
ULTIMATE_CRON_LOG_TYPE_NORMAL,
]) {
if ($lock_id) {
$log_entry = $this->connection
->select('ultimate_cron_log', 'l')
->fields('l')
->condition('l.lid', $lock_id)
->execute()
->fetchObject(LogEntry::class, array(
$name,
$this,
));
}
else {
$log_entry = $this->connection
->select('ultimate_cron_log', 'l')
->fields('l')
->condition('l.name', $name)
->condition('l.log_type', $log_types, 'IN')
->orderBy('l.start_time', 'DESC')
->orderBy('l.end_time', 'DESC')
->range(0, 1)
->execute()
->fetchObject(LogEntry::class, array(
$name,
$this,
));
}
if ($log_entry) {
$log_entry->finished = TRUE;
}
else {
$log_entry = new LogEntry($name, $this);
}
return $log_entry;
}