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]);
     }
 }
Esempio n. 2
0
 /**
  * @group repair
  */
 public function testRebuildApplication()
 {
     $sugar_path = realpath(getenv('SUGARCRM_PATH'));
     $ext_path = $sugar_path . '/custom/Extension/application/Ext/Utils/test_rebuild_application.php';
     $compiled_ext_path = $sugar_path . '/custom/application/Ext/Utils/custom_utils.ext.php';
     $token = md5(mt_rand());
     if (!is_dir(dirname($ext_path))) {
         mkdir(dirname($ext_path), 0750, true);
     }
     file_put_contents($ext_path, "<?php\n// token: {$token}");
     $sys = new System($this->getEntryPointInstance());
     $sys->rebuildApplication();
     $this->assertFileExists($compiled_ext_path);
     $compiled_ext = file_get_contents($compiled_ext_path);
     $this->assertContains("// token: {$token}", $compiled_ext);
 }