public function executeOnRemoteServer(array $commands)
{
/*
* @var \phpseclib\Net\SFTP
*/
$connection = $this->connection->getAdapter()->getConnection();
if ($this->servers[$this->currentlyDeploying]['scheme'] != 'sftp' || get_class($connection) != \phpseclib\Net\SFTP::class) {
$this->cli->yellow()->out("\r\nConnection scheme is not 'sftp' ignoring [pre/post]-deploy-remote");
return;
}
if (!$connection->isConnected()) {
$this->cli->red()->out("\r\nSFTP adapter connection problem skipping '[pre/post]-deploy-remote' commands");
return;
}
foreach ($commands as $command) {
$this->cli->out("Execute remote : <white>{$command}");
$output = $connection->exec($command);
$this->cli->out("Result remote: <white>{$output}");
}
}