コード例 #1
1
 /**
  * @inheritdoc
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     // Validate we can run.
     if ($this->platformConfig === null) {
         $output->writeln('<error>Must run command within a Platform.sh project</error>');
         exit(1);
     }
     $this->projectPath = LocalProject::getProjectRoot();
     $this->projectName = Platform::projectName();
     $this->stdOut = $output;
     $this->stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
     $this->stdIn = $input;
     self::$interactive = $input->isInteractive();
 }
コード例 #2
0
 /**
  *
  */
 public function save()
 {
     $fs = new Filesystem();
     $fs->dumpFile(Platform::sharedDir() . '/settings.local.php', $this->string);
     // Relink if missing.
     if (!$fs->exists(Platform::webDir() . '/sites/default/settings.local.php')) {
         $fs->symlink('../../../shared/settings.local.php', Platform::webDir() . '/sites/default/settings.local.php');
     }
 }
コード例 #3
0
 public function copyConfigs()
 {
     // Copy configs
     foreach ($this->configsToCopy() as $fileName) {
         $this->fs->copy($this->resourcesDir . '/conf/' . $fileName, $this->projectPath . '/docker/conf/' . $fileName);
     }
     // Quick fix to make nginx PHP_IDE_CONFIG dynamic for now.
     $nginxConfFile = $this->projectPath . '/docker/conf/nginx.conf';
     $nginxConf = file_get_contents($nginxConfFile);
     $nginxConf = str_replace('{{ platform }}', Platform::projectName() . '.platform', $nginxConf);
     file_put_contents($nginxConfFile, $nginxConf);
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var ShellHelper $shell */
     $shell = $this->getHelper('shell');
     $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
     $shell->setOutput($output);
     if (!is_dir(LocalProject::getProjectRoot() . '/docker/fg')) {
         $shell->execute(['git', 'clone', 'https://github.com/brendangregg/FlameGraph.git', LocalProject::getProjectRoot() . '/docker/fg']);
     }
     if (!is_dir(LocalProject::getProjectRoot() . '/docker/xhpfg')) {
         $shell->execute(['git', 'clone', 'https://github.com/msonnabaum/xhprof-flamegraphs.git', LocalProject::getProjectRoot() . '/docker/xhpfg']);
     }
     $this->stdOut->writeln("<comment>Patching Drupal for xhprof</comment>");
     $process = new Process('patch -p1 < ' . CLI_ROOT . '/resources/drupal-enable-profiling.patch', Platform::webDir());
     $process->mustRun(null);
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->stdOut->writeln("<info>Syncing Platform.sh environment database to local</info>");
     // @todo this isn't as robust as getCurrentEnvironment().
     $git = $this->getHelper('shell');
     $currentBranch = $git->execute(['git', 'symbolic-ref', '--short', 'HEAD'], Platform::repoDir());
     $remoteAlias = '@' . Platform::projectName() . '.' . $currentBranch;
     $localAlias = '@' . Platform::projectName() . '._local';
     // @todo squeeze this into the ShellHelper arguments somehow.
     exec("drush {$remoteAlias} sql-dump --gzip | gzip -cd | drush {$localAlias} sqlc");
     //        $this->stdOut->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     //        $shell = new ShellHelper($this->stdOut);
     //        $shell->execute([
     //            "drush $remoteAlias sql-dump --gzip | gzip -cd | drush $localAlias sqlc"
     //        ], null, true, false);
 }
コード例 #6
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $url = 'http://' . Platform::projectName() . '.platform:' . Docker::getContainerPort('nginx', '80');
     $this->openUrl($url);
 }
コード例 #7
0
 /**
  * @param $type
  *
  * @return string
  */
 public static function getContainerName($type)
 {
     $projectName = str_replace(array('-', '.'), '', Platform::projectName());
     return $projectName . '_' . $type . '_1';
 }
コード例 #8
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->stdOut->writeln("<comment>Removing patch on Drupal for xhprof</comment>");
     $process = new Process('patch -p1 -R < ' . CLI_ROOT . '/resources/drupal-enable-profiling.patch', Platform::webDir());
     $process->mustRun(null);
 }