{
$this->sudo = $sudo;
}
+
+ public function ddCommand()
+ {
+ $this->_preExecute();
+ $this->makeCommande();
+ dd($this->getCommand());
+ }
}
'set ftp:passive-mode ' . ($this->isPassiveMode() ? '1' : '0')
];
switch ($this->getProtocol()) {
- case 'ftp':
- $commands += [
+ case 'FTP':
+ $commands = array_merge($commands, [
'set ftp:ssl-allow false',
'connect ftp://' . $this->getHost()
- ];
+ ]);
break;
- case 'ftps':
- $commands += ['connect ftps://' . $this->getHost()];
+ case 'FTPS':
+ $commands = array_merge($commands, [
+ 'connect ftps://' . $this->getHost()
+ ]);
break;
- case 'ftpes':
- $commands += [
+ case 'FTPES':
+ $commands = array_merge($commands, [
'set ftp:ssl-force true',
'connect ftp://' . $this->getHost()
- ];
+ ]);
+ break;
}
- $commands += [
- 'mkdir -p ' . $this->getDest(),
- 'cd ' . $this->getDest(),
+ $commands = array_merge($commands, [
+ 'mkdir -p ' . $this->getFinalDest(),
+ 'cd ' . $this->getFinalDest(),
'lcd ' . $this->getSrc(),
- ];
+ ]);
$mirrorCmd = 'mirror --reverse --verbose --parallel=5';
if ($this->getMirror()) {
$mirrorCmd .= ' --delete';
class Rclone extends CloneUserpassProgram
{
+
+ protected $_prog = 'rclone';
/**
* @var string
*/
$this->setArg('sftp-host', $this->getHost());
$this->setArg('sftp-port', $this->getPort());
$this->setArg('sftp-user', $this->getUsername());
- $this->setArg('sftp-pass', $this->getPassword());
+ $this->setArg('sftp-pass', $this->getObscuredPassword());
if ($this->isDryRun()) {
$this->setArg('dry-run');
}
}
switch ($this->getProtocol()) {
case 'local':
- $dest = $this->getDest();
+ $dest = $this->getFinalDest();
break;
default:
- $dest = ':' . $this->getProtocol() . ':' . $this->getDest();
+ $dest = ':' . mb_strtolower($this->getProtocol()) . ':' . $this->getDest();
break;
}
$this->setManualArg($dest);
}
+
+ protected function getObscuredPassword()
+ {
+ $password = $this->getPassword();
+ cache()->rememberForever('rclone_obscure_' . sha1($this->getPassword()), function () use ($password) {
+ return `rclone obscure $password`;
+ });
+ }
}
\ No newline at end of file
class Rsync extends CloneProgram
{
+ protected $_prog = 'rsync';
+
protected $_port = 22;
protected $_excludes = array();
protected function _preExecute()
{
- $dest = $this->getDest();
+ $dest = $this->getFinalDest();
$port = $this->getPort();
$src = $this->getSrc();
$mirror = $this->getMirror();