Skip to content

Commit cb276ce

Browse files
Pin Swift_Mailer to a specific version
1 parent ebe4134 commit cb276ce

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"phpunit/php-timer": "~1.0.2",
3232
"sebastian/environment": "~1.1",
3333
"sebastian/version": "~1.0",
34-
"swiftmailer/swiftmailer": "@stable"
34+
"swiftmailer/swiftmailer": "5.3.*"
3535
},
3636
"require-dev": {
3737
"squizlabs/php_codesniffer": "1.*",

src/Backup/Sync/Rsync.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,66 @@
22
namespace phpbu\Backup\Sync;
33

44
use phpbu\App\Result;
5+
use phpbu\Backup\Cli\Cmd;
56
use phpbu\Backup\Sync;
67
use phpbu\Backup\Target;
78

89
class Rsync implements Sync
910
{
11+
/**
12+
* Configuration
13+
*
14+
* @var array
15+
*/
1016
protected $config;
1117

18+
/**
19+
* (non-PHPdoc)
20+
* @see \phpbu\Backup\Sync::setup()
21+
*/
1222
public function setup(array $config)
1323
{
1424
$this->config = $config;
1525
}
1626

27+
/**
28+
* (non-PHPdoc)
29+
* @see \phpbu\Backup\Sync::sync()
30+
*/
1731
public function sync(Target $target, Result $result)
1832
{
1933
throw new Exception('NotImplementedException');
34+
$rsync = new Cmd('rsync');
35+
36+
if (isset($this->config['args'])) {
37+
$exec = 'rsync ' . $args;
38+
} else {
39+
// use archive mode, verbose and compress if not allready done
40+
$options = '-av' . $target->shouldBeCompressed() ? '' : 'z';
41+
$rsync->addOption($options);
42+
// sync folder
43+
// --delete
44+
45+
// add target as source
46+
$rsync->addOption($target->getFilenameCompressed());
47+
48+
$syncTarget = '';
49+
50+
// remote user
51+
if (isset($this->config['user'])) {
52+
$syncTarget .= $this->config['user'] . '@';
53+
}
54+
55+
// remote host
56+
if (isset($this->config['host'])) {
57+
$syncTarget .= $this->config['host'] . ':';
58+
}
59+
60+
// remote path
61+
if (isset($this->config['path'])) {
62+
$syncTarget .= $this->config['path'];
63+
}
64+
65+
}
2066
}
2167
}

0 commit comments

Comments
 (0)