You are here

public static function UltimateCronProgress::getProgressMultiple in Ultimate Cron 7.2

Get multiple job progresses.

Parameters

array $names: Job names to get progress for.

Return value

array Progress of jobs, keyed by job name.

File

./ultimate_cron.progress.inc, line 75
Pseudo namespace for progress functions.

Class

UltimateCronProgress
Class for handling Ultimate Cron progress.

Code

public static function getProgressMultiple($names) {
  $keys = array();
  foreach ($names as $name) {
    $keys[] = 'uc-progress:' . $name;
  }
  $target = _ultimate_cron_get_transactional_safe_connection();
  $values = db_select('variable', 'v', array(
    'target' => $target,
  ))
    ->fields('v', array(
    'name',
    'value',
  ))
    ->condition('v.name', $keys, 'IN')
    ->execute()
    ->fetchAllAssoc('name', PDO::FETCH_OBJ);
  $result = array();
  foreach ($names as $name) {
    $result[$name] = isset($values['uc-progress:' . $name]) ? unserialize($values['uc-progress:' . $name]->value) : FALSE;
  }
  return $result;
}