1 | <?php |
||
20 | class Rsync extends Abstraction implements Executable |
||
21 | { |
||
22 | /** |
||
23 | * Source |
||
24 | * |
||
25 | * @var \phpbu\App\Cli\Executable\Rsync\Location |
||
26 | */ |
||
27 | private $source; |
||
28 | |||
29 | /** |
||
30 | * Target |
||
31 | * |
||
32 | * @var \phpbu\App\Cli\Executable\Rsync\Location |
||
33 | */ |
||
34 | private $target; |
||
35 | |||
36 | /** |
||
37 | * Raw args |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $args; |
||
42 | |||
43 | /** |
||
44 | * Files to ignore, extracted from config string separated by ":" |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $excludes = []; |
||
49 | |||
50 | /** |
||
51 | * Remove deleted files remotely as well |
||
52 | * |
||
53 | * @var boolean |
||
54 | */ |
||
55 | protected $delete; |
||
56 | |||
57 | /** |
||
58 | * Compress data. |
||
59 | * |
||
60 | * @var boolean |
||
61 | */ |
||
62 | protected $compressed = false; |
||
63 | |||
64 | /** |
||
65 | * Constructor. |
||
66 | * |
||
67 | * @param string $path |
||
68 | */ |
||
69 | public function __construct($path = null) |
||
75 | |||
76 | /** |
||
77 | * Set custom args |
||
78 | * |
||
79 | * @param string $args |
||
80 | * @return \phpbu\App\Cli\Executable\Rsync |
||
81 | */ |
||
82 | public function useArgs($args) |
||
87 | 15 | ||
88 | /** |
||
89 | * Set source user. |
||
90 | * |
||
91 | * @param string $user |
||
92 | * @return \phpbu\App\Cli\Executable\Rsync |
||
93 | */ |
||
94 | public function fromUser($user) |
||
99 | |||
100 | /** |
||
101 | * Set source host. |
||
102 | * |
||
103 | * @param string $host |
||
104 | * @return \phpbu\App\Cli\Executable\Rsync |
||
105 | */ |
||
106 | public function fromHost($host) |
||
111 | |||
112 | /** |
||
113 | * Set source path. |
||
114 | * |
||
115 | * @param string $path |
||
116 | * @return \phpbu\App\Cli\Executable\Rsync |
||
117 | */ |
||
118 | public function fromPath($path) |
||
123 | |||
124 | /** |
||
125 | * Use compression. |
||
126 | * |
||
127 | * @param bool $bool |
||
128 | * @return \phpbu\App\Cli\Executable\Rsync |
||
129 | */ |
||
130 | public function compressed($bool) |
||
135 | |||
136 | /** |
||
137 | * Sync to host. |
||
138 | * |
||
139 | * @param string $host |
||
140 | * @return \phpbu\App\Cli\Executable\Rsync |
||
141 | */ |
||
142 | public function toHost($host) |
||
147 | |||
148 | /** |
||
149 | * Set path to sync to. |
||
150 | * |
||
151 | * @param string $path |
||
152 | * @return \phpbu\App\Cli\Executable\Rsync |
||
153 | */ |
||
154 | public function toPath($path) |
||
159 | |||
160 | /** |
||
161 | * Set user to connect as. |
||
162 | * |
||
163 | * @param string $user |
||
164 | * @return \phpbu\App\Cli\Executable\Rsync |
||
165 | */ |
||
166 | public function toUser($user) |
||
171 | |||
172 | /** |
||
173 | * Exclude files. |
||
174 | * |
||
175 | * @param array $excludes |
||
176 | * @return \phpbu\App\Cli\Executable\Rsync |
||
177 | */ |
||
178 | public function exclude(array $excludes) |
||
183 | |||
184 | /** |
||
185 | * Use --delete option. |
||
186 | * |
||
187 | * @param boolean $bool |
||
188 | * @return \phpbu\App\Cli\Executable\Rsync |
||
189 | */ |
||
190 | public function removeDeleted($bool) |
||
195 | 11 | ||
196 | /** |
||
197 | 11 | * Subclass Process generator. |
|
198 | 2 | * |
|
199 | 2 | * @return \phpbu\App\Cli\Process |
|
200 | 9 | * @throws \phpbu\App\Exception |
|
201 | 1 | */ |
|
202 | protected function createProcess() |
||
229 | |||
230 | /** |
||
231 | 9 | * Configure excludes. |
|
232 | * |
||
233 | * @param \phpbu\App\Cli\Cmd $cmd |
||
234 | * @param array $excludes |
||
235 | */ |
||
236 | protected function configureExcludes(Cmd $cmd, array $excludes) |
||
242 | } |
||
243 |