1 | <?php |
||
8 | abstract class BackupEngineAbstract implements BackupEngineInterface |
||
9 | { |
||
10 | /** |
||
11 | * Command instance. |
||
12 | * |
||
13 | * @var \Cornford\Backup\BackupProcess |
||
14 | */ |
||
15 | protected static $backupProcessInstance; |
||
16 | |||
17 | /** |
||
18 | * Database export command. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $exportCommand; |
||
23 | |||
24 | /** |
||
25 | * Database restore command. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $restoreCommand; |
||
30 | |||
31 | /** |
||
32 | * Database name. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $database; |
||
37 | |||
38 | /** |
||
39 | * Database hostname. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $hostname; |
||
44 | |||
45 | /** |
||
46 | * Database port. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $port; |
||
51 | |||
52 | /** |
||
53 | * Database username. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $username; |
||
58 | |||
59 | /** |
||
60 | * Database password. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $password; |
||
65 | |||
66 | /** |
||
67 | * Database options. |
||
68 | * |
||
69 | * @var array |
||
70 | */ |
||
71 | protected $options; |
||
72 | |||
73 | /** |
||
74 | * Backup engine constructor. |
||
75 | * |
||
76 | * @param BackupProcess $backupProcess |
||
77 | * @param string $hostname |
||
78 | * @param string $port |
||
79 | * @param string $database |
||
80 | * @param string $username |
||
81 | * @param string $password |
||
82 | * @param array $options |
||
83 | */ |
||
84 | public function __construct( |
||
101 | |||
102 | /** |
||
103 | * Set backup process instance. |
||
104 | * |
||
105 | * @param BackupProcess $value |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | public function setBackupProcess(BackupProcess $value) |
||
113 | |||
114 | /** |
||
115 | * Get backup process instance. |
||
116 | * |
||
117 | * @return BackupProcess |
||
118 | */ |
||
119 | public function getBackupProcess() |
||
123 | |||
124 | /** |
||
125 | * Set database export command. |
||
126 | * |
||
127 | * @param string $value |
||
128 | * |
||
129 | * @return self |
||
130 | */ |
||
131 | public function setExportCommand($value) |
||
137 | |||
138 | /** |
||
139 | * Get database export command. |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | public function getExportCommand() |
||
147 | |||
148 | /** |
||
149 | * Set database restore command. |
||
150 | * |
||
151 | * @param string $value |
||
152 | * |
||
153 | * @return self |
||
154 | */ |
||
155 | public function setRestoreCommand($value) |
||
161 | |||
162 | /** |
||
163 | * Get database restore command. |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | public function getRestoreCommand() |
||
171 | |||
172 | /** |
||
173 | * Set database name. |
||
174 | * |
||
175 | * @param string $value |
||
176 | * |
||
177 | * @return self |
||
178 | */ |
||
179 | public function setDatabase($value) |
||
185 | |||
186 | /** |
||
187 | * Get database name. |
||
188 | * |
||
189 | * @return string |
||
190 | */ |
||
191 | public function getDatabase() |
||
195 | |||
196 | /** |
||
197 | * Set database hostname. |
||
198 | * |
||
199 | * @param string $value |
||
200 | * |
||
201 | * @return self |
||
202 | */ |
||
203 | public function setHostname($value) |
||
209 | |||
210 | /** |
||
211 | * Get database hostname. |
||
212 | * |
||
213 | * @return string |
||
214 | */ |
||
215 | public function getHostname() |
||
219 | |||
220 | /** |
||
221 | * Set database port. |
||
222 | * |
||
223 | * @param string $value |
||
224 | * |
||
225 | * @return self |
||
226 | */ |
||
227 | public function setPort($value) |
||
233 | |||
234 | /** |
||
235 | * Get database port. |
||
236 | * |
||
237 | * @return string |
||
238 | */ |
||
239 | public function getPort() |
||
243 | |||
244 | /** |
||
245 | * Set database username. |
||
246 | * |
||
247 | * @param string $value |
||
248 | * |
||
249 | * @return self |
||
250 | */ |
||
251 | public function setUsername($value) |
||
257 | |||
258 | /** |
||
259 | * Get database username. |
||
260 | * |
||
261 | * @return string |
||
262 | */ |
||
263 | public function getUsername() |
||
267 | |||
268 | /** |
||
269 | * Set database password. |
||
270 | * |
||
271 | * @param string $value |
||
272 | * |
||
273 | * @return self |
||
274 | */ |
||
275 | public function setPassword($value) |
||
281 | |||
282 | /** |
||
283 | * Get database password. |
||
284 | * |
||
285 | * @return string |
||
286 | */ |
||
287 | public function getPassword() |
||
291 | |||
292 | /** |
||
293 | * Set database options. |
||
294 | * |
||
295 | * @param array $value |
||
296 | * |
||
297 | * @return self |
||
298 | */ |
||
299 | public function setOptions($value) |
||
305 | |||
306 | /** |
||
307 | * Get database options. |
||
308 | * |
||
309 | * @return array |
||
310 | */ |
||
311 | public function getOptions() |
||
315 | |||
316 | /** |
||
317 | * Get export process. |
||
318 | * |
||
319 | * @return string |
||
320 | */ |
||
321 | abstract public function getExportProcess(); |
||
322 | |||
323 | /** |
||
324 | * Get restore process. |
||
325 | * |
||
326 | * @return string |
||
327 | */ |
||
328 | abstract public function getRestoreProcess(); |
||
329 | |||
330 | /** |
||
331 | * Get database file extension. |
||
332 | * |
||
333 | * @return string |
||
334 | */ |
||
335 | abstract public function getFileExtension(); |
||
336 | |||
337 | /** |
||
338 | * Export the database to a file. |
||
339 | * |
||
340 | * @param string $filepath |
||
341 | * |
||
342 | * @return bool |
||
343 | */ |
||
344 | abstract public function export($filepath); |
||
345 | |||
346 | /** |
||
347 | * Restore the database from a file path. |
||
348 | * |
||
349 | * @param string $filepath |
||
350 | * |
||
351 | * @return bool |
||
352 | */ |
||
353 | abstract public function restore($filepath); |
||
354 | |||
355 | /** |
||
356 | * Get the process output. |
||
357 | * |
||
358 | * @return string |
||
359 | */ |
||
360 | public function getProcessOutput() |
||
364 | } |
||
365 |