protected function execute(InputInterface $input, OutputInterface $output)
 {
     $sugarEP = $this->getService('sugarcrm.entrypoint');
     $output->writeln('<comment>Reparation</comment>: ');
     $progress = new ProgressIndicator($output);
     $progress->start('Starting...');
     $progress->advance();
     $sugarSystem = new SugarSystem($sugarEP);
     $progress->setMessage('Working...');
     $messages = $sugarSystem->repairAll($input->getOption('force'));
     $progress->finish('<info>Repair Done.</info>');
     if ($output->isVerbose()) {
         $output->writeln(PHP_EOL . '<comment>General Messages</comment>: ');
         $output->writeln($messages[0]);
     }
     if ($input->getOption('no-database') === true) {
         return;
     }
     $output->writeln(PHP_EOL . '<comment>Database Messages</comment>: ');
     // We have something to sync
     if (strpos($messages[1], 'Database tables are synced with vardefs') !== 0) {
         if ($input->getOption('force') === false) {
             $output->writeln($messages[1]);
             $output->writeln(PHP_EOL . '<error>You need to use --force to run the queries</error>');
         } else {
             $output->writeln('<info>Queries run, try another repair to verify</info>');
         }
         // Nothing to sync, default sugar message
     } else {
         $output->writeln($messages[1]);
     }
 }
Пример #2
0
 /**
  * Get the progress indicator.
  *
  * @return \Symfony\Component\Console\Helper\ProgressIndicator
  */
 private function getIndicator()
 {
     if (!$this->indicator) {
         $this->indicator = new ProgressIndicator($this->io);
         $this->indicator->start('Starting...');
     }
     return $this->indicator;
 }
 /**
  * Run the processes in parallel.
  *
  * @param OutputInterface $output
  */
 private function runProcesses(OutputInterface $output)
 {
     $progress = new ProgressIndicator($output);
     $progress->start('Starting...');
     // Start all of the processes.
     foreach ($this->processes as $process) {
         $process->start();
         $progress->advance();
     }
     // Wait for each to be done.
     foreach ($this->processes as $name => $process) {
         $progress->setMessage(sprintf('Waiting for moodle-plugin-ci %s...', $name));
         while ($process->isRunning()) {
             $progress->advance();
         }
     }
     $progress->finish('Done!');
 }
 /**
  * @dataProvider provideFormat
  */
 public function testFormats($format)
 {
     $bar = new ProgressIndicator($output = $this->getOutputStream(), $format);
     $bar->start('Starting...');
     $bar->advance();
     rewind($output->getStream());
     $this->assertNotEmpty(stream_get_contents($output->getStream()));
 }
Пример #5
0
 protected function finish($message)
 {
     if ($this->verbose) {
         $this->process->finish($message);
     }
 }