public function next()
 {
     $limit = array_shift($this->args);
     $this->out('Retrieving Queue List.');
     $queue = Queue::next($limit, false);
     $i = 1;
     foreach ($queue as $task) {
         $this->out($i . ') ' . Queue::view($task['QueueTask']['id']));
         $i++;
     }
 }
예제 #2
0
 public function next()
 {
     $limit = array_shift($this->args);
     $minimal = filter_var(array_shift($this->args), FILTER_VALIDATE_BOOLEAN);
     if (!$minimal) {
         $this->out('Retrieving Queue List.');
     }
     $queue = Queue::next($limit);
     $i = 1;
     foreach ($queue as $task) {
         if ($minimal) {
             print $task['QueueTask']['id'] . "\r\n";
         } else {
             $this->out($i . ') ' . Queue::view($task['QueueTask']['id']));
         }
         $i++;
     }
 }
예제 #3
0
 /**
  * Run a database query for each Query in the Queue and return a Queue of QueryResults.
  * @param object QueueInterface A queue object which holds the queries to run.
  * @param integer $dbIndex The index of the database on which to run the query. Default is 0, the database created on handler instantiation.
  * @return object QueInterface Returns a Queue of QueryResults.
  * @access public
  */
 function queryQueue(Queue $queue, $dbIndex = 0)
 {
     if (isset($this->recordQueryCallers) && $this->recordQueryCallers) {
         if (!isset($this->queryCallers)) {
             $this->queryCallers = array();
         }
         $backtrace = debug_backtrace();
         $this->queryCallers[] = $backtrace[1]['class'] . $backtrace[1]['type'] . $backtrace[1]['function'] . "()";
     }
     // ** parameter validation
     $this->_validateDBIndex($dbIndex);
     // ** end of parameter validation
     $resultQueue = new Queue();
     while ($queue->hasNext()) {
         $result = $this->_databases[$dbIndex]->query($queue->next());
         $resultQueue->add($result);
     }
     return $resultQueue;
 }
예제 #4
0
 function testRewind()
 {
     $testReversedQueue = new Queue();
     $test1 = new Queue();
     $test2 = new Queue();
     $test3 = new Queue();
     $test4 = new Queue();
     $test5 = new Queue();
     $testReversedQueue->add($test1);
     $testReversedQueue->add($test2);
     $testReversedQueue->add($test3);
     $this->assertReference($test1, $testReversedQueue->next());
     $this->assertReference($test2, $testReversedQueue->next());
     $testReversedQueue->rewind();
     $this->assertReference($test1, $testReversedQueue->next());
 }