示例#1
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var \Symfony\Component\Console\Helper\ProcessHelper $process */
     $process = $this->getHelper('process');
     $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
     if (!is_dir(Platform::rootDir() . '/docker/fg')) {
         $process->mustRun($output, ['git', 'clone', 'https://github.com/brendangregg/FlameGraph.git', Platform::rootDir() . '/docker/fg']);
     }
     if (!is_dir(Platform::rootDir() . '/docker/xhpfg')) {
         $process->mustRun($output, ['git', 'clone', 'https://github.com/msonnabaum/xhprof-flamegraphs.git', Platform::rootDir() . '/docker/xhpfg']);
     }
     $stack = StacksFactory::getStack(Platform::webDir());
     switch ($stack->type()) {
         case Stacks\Drupal::TYPE:
             $this->stdOut->writeln("<comment>Patching Drupal for xhprof</comment>");
             $patchProcess = new Process('patch -p1 < ' . CLI_ROOT . '/resources/drupal-enable-profiling.patch', Platform::webDir());
             break;
         case Stacks\WordPress::TYPE:
             $this->stdOut->writeln("<comment>Patching WordPress for xhprof</comment>");
             $patchProcess = new Process('patch -p0 < ' . CLI_ROOT . '/resources/wordpress-enable-profiling.patch', Platform::webDir());
             break;
         default:
             throw new \Exception('Stack type not supported yet.');
     }
     $patchProcess->mustRun();
 }
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $stack = StacksFactory::getStack(Platform::webDir());
     switch ($stack->type()) {
         case Stacks\Drupal::TYPE:
             $this->stdOut->writeln("<comment>Removing patch on Drupal for xhprof</comment>");
             $patchProcess = new Process('patch -p1 -R < ' . CLI_ROOT . '/resources/drupal-enable-profiling.patch', Platform::webDir());
             break;
         case Stacks\WordPress::TYPE:
             $this->stdOut->writeln("<comment>Removing patch on WordPress for xhprof</comment>");
             $patchProcess = new Process('patch -p0 -R < ' . CLI_ROOT . '/resources/wordpress-enable-profiling.patch', Platform::webDir());
             break;
         default:
             throw new \Exception('Stack type not supported yet.');
     }
     $patchProcess->mustRun(null);
 }