/**
  * Executes this task
  *
  * @param \TYPO3\Deploy\Domain\Model\Node $node
  * @param \TYPO3\Deploy\Domain\Model\Application $application
  * @param \TYPO3\Deploy\Domain\Model\Deployment $deployment
  * @param array $options
  * @return void
  */
 public function execute(Node $node, Application $application, Deployment $deployment, array $options = array())
 {
     $targetReleasePath = $deployment->getApplicationReleasePath($application);
     $username = $node->getOption('username');
     $hostname = $node->getHostname();
     $configurationPath = $this->getDeploymentConfigurationPath() . '/Configuration/' . $deployment->getName() . '/';
     $encryptedConfiguration = \TYPO3\FLOW3\Utility\Files::readDirectoryRecursively($configurationPath, 'yaml.encrypted');
     if (count($encryptedConfiguration) > 0) {
         throw new \Exception('You have sealed configuration files, please open the configuration for "' . $deployment->getName() . '"', 1317229449);
     }
     $configurations = \TYPO3\FLOW3\Utility\Files::readDirectoryRecursively($configurationPath, 'yaml');
     $commands = array();
     foreach ($configurations as $configuration) {
         $targetConfigurationPath = dirname(str_replace($configurationPath, '', $configuration));
         $commands[] = "scp {$configuration} {$username}@{$hostname}:{$targetReleasePath}/Configuration/{$targetConfigurationPath}/";
     }
     $localhost = new Node('localhost');
     $localhost->setHostname('localhost');
     $this->shell->executeOrSimulate($commands, $localhost, $deployment);
 }
Пример #2
0
 /**
  * Execute a shell command via SSH
  *
  * @param mixed $command
  * @param \TYPO3\Deploy\Domain\Model\Node $node
  * @param \TYPO3\Deploy\Domain\Model\Deployment $deployment
  * @return array
  */
 protected function executeRemoteCommand($command, Node $node, Deployment $deployment)
 {
     $command = $this->prepareCommand($command);
     $deployment->getLogger()->log('    $' . $node->getName() . ': "' . $command . '"', LOG_DEBUG);
     $username = $node->getOption('username');
     $hostname = $node->getHostname();
     $returnedOutput = '';
     // TODO Get SSH options from node or deployment
     $fp = popen('ssh -A ' . $username . '@' . $hostname . ' ' . escapeshellarg($command) . ' 2>&1', 'r');
     while (($line = fgets($fp)) !== FALSE) {
         $deployment->getLogger()->log('    > ' . rtrim($line));
         $returnedOutput .= $line;
     }
     $exitCode = pclose($fp);
     return array($exitCode, $returnedOutput);
 }