/** * @inheritdoc */ public function prepare($buildDir, LocalApplication $app, CliConfig $config, array $settings = []) { $this->app = $app; $this->appRoot = $app->getRoot(); $this->documentRoot = $app->getDocumentRoot(); $this->settings = $settings; $this->config = $config; if ($this->config->get('local.copy_on_windows')) { $this->fsHelper->setCopyOnWindows(true); } $this->ignoredFiles[] = $this->config->get('local.web_root'); $this->setBuildDir($buildDir); if (!empty($settings['clone'])) { $settings['copy'] = true; } $this->copy = !empty($settings['copy']); $this->fsHelper->setRelativeLinks(empty($settings['abslinks'])); }
/** * @param Environment $environment * @param LocalApplication $app * @param bool $multiApp * * @return array|false */ protected function generateRemoteAlias($environment, $app, $multiApp = false) { if (!$environment->hasLink('ssh') || !$environment->hasLink('public-url')) { return false; } $sshUrl = parse_url($environment->getLink('ssh')); if (!$sshUrl) { return false; } $sshUser = $sshUrl['user']; if ($multiApp) { $sshUser .= '--' . $app->getName(); } $uri = $environment->getLink('public-url'); if ($multiApp) { $guess = str_replace('http://', 'http://' . $app->getName() . '---', $uri); if (in_array($guess, $environment->getRouteUrls())) { $uri = $guess; } } return ['uri' => $uri, 'remote-host' => $sshUrl['host'], 'remote-user' => $sshUser, 'root' => '/app/' . $app->getDocumentRoot(), $this->getAutoRemoveKey() => true, 'command-specific' => ['site-install' => ['sites-subdir' => 'default']]]; }