You are here

function drush_advancedqueue_list in Advanced Queue 7

Command callback for drush advancedqueue-list.

File

drush/advancedqueue.drush.inc, line 115
Drush worker for Advanced-queue.

Code

function drush_advancedqueue_list() {
  $queues = drush_advancedqueue_get_queues();
  $rows = array(
    array(
      'Queue',
      'Items',
      'Class',
    ),
  );
  foreach (array_keys($queues) as $name) {
    $q = DrupalQueue::get($name);
    $rows[] = array(
      $name,
      $q
        ->numberOfItems(),
      get_class($q),
    );
  }
  if (drush_get_option('pipe')) {
    $pipe = array();
    array_shift($rows);
    foreach ($rows as $r) {
      $pipe[] = implode(",", $r);
    }
    drush_print_pipe($pipe);
  }
  else {
    drush_print_table($rows, TRUE);
  }

  // Return the result for backend invoke
  return $rows;
}