original_string: public function tail()
      {
          $logs = array();
          $i = 1;
          $workers = $this->ResqueStatus->getWorkers();
  
          foreach ($workers as $worker) {
              if ($worker['Log']['filename'] != '') {
                  $logs[] = $worker['Log']['filename'];
              }
              if ($worker['Log']['handler'] == 'RotatingFile') {
                  $fileInfo = pathinfo($worker['Log']['target']);
                  $pattern = $fileInfo['dirname'] . DS . $fileInfo['filename'] . '-*' .
                  (!empty($fileInfo['extension']) ? '.' . $fileInfo['extension'] : '');
  
                  $logs = array_merge($logs, glob($pattern));
              }
          }
  
          $logs = array_values(array_unique($logs));
  
          $this->outputTitle('Tailing log file');
          if (empty($logs)) {
              $this->output->outputLine('No log file to tail', 'failure');
              return;
          } elseif (count($logs) == 1) {
              $index = 1;
          } else {
              $menuOptions = new \ezcConsoleMenuDialogOptions(
                  array(
                      'text' => 'Log files list',
                      'selectText' => 'Log to tail :',
                      'validator' => new DialogMenuValidator(array_combine(range(1, count($logs)), $logs))
                  )
              );
              $menuDialog = new \ezcConsoleMenuDialog($this->output, $menuOptions);
              do {
                  $menuDialog->display();
              } while ($menuDialog->hasValidResult() === false);
  
              $index = $menuDialog->getResult();
          }
  
          $this->output->outputLine('Tailing ' . $logs[$index - 1], 'subtitle');
          $this->tailCommand($logs[$index - 1]);
      }
code: public function tail()
      {
          $logs = array();
          $i = 1;
          $workers = $this->ResqueStatus->getWorkers();
  
          foreach ($workers as $worker) {
              if ($worker['Log']['filename'] != '') {
                  $logs[] = $worker['Log']['filename'];
              }
              if ($worker['Log']['handler'] == 'RotatingFile') {
                  $fileInfo = pathinfo($worker['Log']['target']);
                  $pattern = $fileInfo['dirname'] . DS . $fileInfo['filename'] . '-*' .
                  (!empty($fileInfo['extension']) ? '.' . $fileInfo['extension'] : '');
  
                  $logs = array_merge($logs, glob($pattern));
              }
          }
  
          $logs = array_values(array_unique($logs));
  
          $this->outputTitle('Tailing log file');
          if (empty($logs)) {
              $this->output->outputLine('No log file to tail', 'failure');
              return;
          } elseif (count($logs) == 1) {
              $index = 1;
          } else {
              $menuOptions = new \ezcConsoleMenuDialogOptions(
                  array(
                      'text' => 'Log files list',
                      'selectText' => 'Log to tail :',
                      'validator' => new DialogMenuValidator(array_combine(range(1, count($logs)), $logs))
                  )
              );
              $menuDialog = new \ezcConsoleMenuDialog($this->output, $menuOptions);
              do {
                  $menuDialog->display();
              } while ($menuDialog->hasValidResult() === false);
  
              $index = $menuDialog->getResult();
          }
  
          $this->output->outputLine('Tailing ' . $logs[$index - 1], 'subtitle');
          $this->tailCommand($logs[$index - 1]);
      }
code_tokens: public function tail ( ) { $ logs = array ( ) ; $ i = 1 ; $ workers = $ this -> ResqueStatus -> getWorkers ( ) ; foreach ( $ workers as $ worker ) { if ( $ worker [ 'Log' ] [ 'filename' ] != '' ) { $ logs [ ] = $ worker [ 'Log' ] [ 'filename' ] ; } if ( $ worker [ 'Log' ] [ 'handler' ] == 'RotatingFile' ) { $ fileInfo = pathinfo ( $ worker [ 'Log' ] [ 'target' ] ) ; $ pattern = $ fileInfo [ 'dirname' ] . DS . $ fileInfo [ 'filename' ] . '-*' . ( ! empty ( $ fileInfo [ 'extension' ] ) ? '.' . $ fileInfo [ 'extension' ] : '' ) ; $ logs = array_merge ( $ logs , glob ( $ pattern ) ) ; } } $ logs = array_values ( array_unique ( $ logs ) ) ; $ this -> outputTitle ( 'Tailing log file' ) ; if ( empty ( $ logs ) ) { $ this -> output -> outputLine ( 'No log file to tail' , 'failure' ) ; return ; } elseif ( count ( $ logs ) == 1 ) { $ index = 1 ; } else { $ menuOptions = new \ ezcConsoleMenuDialogOptions ( array ( 'text' => 'Log files list' , 'selectText' => 'Log to tail :' , 'validator' => new DialogMenuValidator ( array_combine ( range ( 1 , count ( $ logs ) ) , $ logs ) ) ) ) ; $ menuDialog = new \ ezcConsoleMenuDialog ( $ this -> output , $ menuOptions ) ; do { $ menuDialog -> display ( ) ; } while ( $ menuDialog -> hasValidResult ( ) === false ) ; $ index = $ menuDialog -> getResult ( ) ; } $ this -> output -> outputLine ( 'Tailing ' . $ logs [ $ index - 1 ] , 'subtitle' ) ; $ this -> tailCommand ( $ logs [ $ index - 1 ] ) ; }
docstring: Tail a log file
  
  If more than one log file exists, will display a menu dialog with a list
  of log files to choose from.
  
  @return  void
docstring_tokens: Tail a log file