1 | <?php |
||
23 | class Redis extends Cli implements Source |
||
24 | { |
||
25 | /** |
||
26 | * Redis Executable |
||
27 | * |
||
28 | * @var \phpbu\App\Cli\Executable\RedisCli |
||
29 | */ |
||
30 | private $executableLast; |
||
|
|||
31 | |||
32 | /** |
||
33 | * Path to executable. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | private $pathToRedisCli; |
||
38 | |||
39 | /** |
||
40 | * Show stdErr |
||
41 | * |
||
42 | * @var boolean |
||
43 | */ |
||
44 | private $showStdErr; |
||
45 | |||
46 | /** |
||
47 | * Time to wait for the dump to finish |
||
48 | * |
||
49 | * @var integer |
||
50 | */ |
||
51 | private $timeout; |
||
52 | |||
53 | /** |
||
54 | * Host to backup |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | private $host; |
||
59 | |||
60 | /** |
||
61 | * Port to connect to |
||
62 | * |
||
63 | * @var boolean |
||
64 | */ |
||
65 | private $port; |
||
66 | |||
67 | /** |
||
68 | * Password for authentication |
||
69 | * |
||
70 | * @var string |
||
71 | */ |
||
72 | private $password; |
||
73 | |||
74 | /** |
||
75 | * Path to the redis rdb directory, for Debian it's /var/lib/redis/{PORT}/dump.rdb |
||
76 | * |
||
77 | * @var string |
||
78 | */ |
||
79 | private $pathToRedisData; |
||
80 | |||
81 | /** |
||
82 | * Setup. |
||
83 | * |
||
84 | * @see \phpbu\App\Backup\Source |
||
85 | * @param array $conf |
||
86 | * @throws \phpbu\App\Exception |
||
87 | */ |
||
88 | public function setup(array $conf = array()) |
||
102 | |||
103 | /** |
||
104 | * Execute the backup. |
||
105 | * |
||
106 | * @see \phpbu\App\Backup\Source |
||
107 | * @param \phpbu\App\Backup\Target $target |
||
108 | * @param \phpbu\App\Result $result |
||
109 | * @return \phpbu\App\Backup\Source\Status |
||
110 | * @throws \phpbu\App\Exception |
||
111 | */ |
||
112 | public function backup(Target $target, Result $result) |
||
134 | |||
135 | /** |
||
136 | * Setup the Executable to run the 'tar' command. |
||
137 | * |
||
138 | * @param \phpbu\App\Backup\Target |
||
139 | * @return \phpbu\App\Cli\Executable |
||
140 | */ |
||
141 | public function getExecutable(Target $target) |
||
153 | |||
154 | /** |
||
155 | * Return last successful save timestamp. |
||
156 | * |
||
157 | * @param \phpbu\App\Cli\Executable\RedisCli $redis |
||
158 | * @return int |
||
159 | * @throws \phpbu\App\Exception |
||
160 | */ |
||
161 | private function getLastBackupTime(Executable\RedisCli $redis) |
||
171 | |||
172 | /** |
||
173 | * Check the dump date and return true if BGSAVE is finished. |
||
174 | * |
||
175 | * @param int $lastTimestamp |
||
176 | * @param \phpbu\App\Cli\Executable\RedisCli $redis |
||
177 | * @return bool |
||
178 | * @throws \phpbu\App\Exception |
||
179 | */ |
||
180 | private function isDumpCreatedYet($lastTimestamp, $redis) |
||
192 | |||
193 | /** |
||
194 | * Copy the redis RDB file to its backup location. |
||
195 | * |
||
196 | * @param \phpbu\App\Backup\Target $target |
||
197 | * @return string |
||
198 | * @throws \phpbu\App\Exception |
||
199 | */ |
||
200 | private function copyDumpToTargetDir(Target $target) |
||
209 | } |
||
210 |
This check marks private properties in classes that are never used. Those properties can be removed.