{
protected $_prog = '/usr/bin/lftp';
- protected $_ftpTimeout = 120;
+ protected $_ftpTimeout = 20;
/**
* @var bool
{
parent::_preExecute();
$commands = [
- 'set net:reconnect-interval-base 5',
+ 'set net:reconnect-interval-base 1',
'set net:timeout ' . $this->getFTPTimeout(),
- 'set net:max-retries 5',
+ 'set net:max-retries 1',
'set ftp:passive-mode ' . ($this->isPassiveMode() ? '1' : '0')
];
break;
}
+ $fdest = $this->getFinalDest();
+ $cmd = [];
+ if ($fdest !== '/') {
+ $cmd[] = 'mkdir -p ' . $fdest;
+ $cmd[] = 'cd ' . $fdest;
+ }
+
if (is_dir($this->getSrc())) {
- $commands = array_merge($commands, [
- 'mkdir -p ' . $this->getFinalDest(),
- 'cd ' . $this->getFinalDest(),
- 'lcd ' . $this->getSrc(),
- ]);
+ $cmd[] = 'lcd ' . $this->getSrc();
+ $commands = array_merge($commands, $cmd);
$mirrorCmd = 'mirror --reverse --verbose --parallel=5';
if ($this->getMirror()) {
$mirrorCmd .= ' --delete';
} else {
$filename = explode('/', $this->getSrc());
$filename = end($filename);
- $commands = array_merge($commands, [
- 'mkdir -p ' . $this->getFinalDest(),
- 'cd ' . $this->getFinalDest(),
- 'put ' . $this->getSrc()
- ]);
+ $cmd[] = 'put ' . $this->getSrc();
+ $commands = array_merge($commands, $cmd);
if ($this->isDryRun()) {
throw new \Exception("dry-run flag is incompatible for sending files");
}
}
- $this->setArg('c', 'open ' . $this->getUsername() . ':' . $this->_escapePassword($this->getPassword()) . '@' . $this->getHost() . ':' . $this->getPort() . ' ' . implode(';', $commands));
+ $this->setArg('c', 'open ' . $this->getUsername() . ':' . $this->_escapePassword($this->getPassword()) . '@' . $this->getHost() . ':' . $this->getPort() . ';' . implode(';', $commands));
}
protected function _escapePassword($password)