File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change 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.*" ,
Original file line number Diff line number Diff line change 22namespace phpbu \Backup \Sync ;
33
44use phpbu \App \Result ;
5+ use phpbu \Backup \Cli \Cmd ;
56use phpbu \Backup \Sync ;
67use phpbu \Backup \Target ;
78
89class 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}
You can’t perform that action at this time.
0 commit comments