1 | <?php |
||
23 | class Redis extends Cli implements Source |
||
24 | { |
||
25 | /** |
||
26 | * Path to executable. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | private $pathToRedisCli; |
||
31 | |||
32 | /** |
||
33 | * Show stdErr |
||
34 | * |
||
35 | * @var boolean |
||
36 | */ |
||
37 | private $showStdErr; |
||
38 | |||
39 | /** |
||
40 | * Time to wait for the dump to finish |
||
41 | * |
||
42 | * @var integer |
||
43 | */ |
||
44 | private $timeout; |
||
45 | |||
46 | /** |
||
47 | * Host to backup |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $host; |
||
52 | |||
53 | /** |
||
54 | * Port to connect to |
||
55 | * |
||
56 | * @var int |
||
57 | */ |
||
58 | private $port; |
||
59 | |||
60 | /** |
||
61 | * Password for authentication |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | private $password; |
||
66 | |||
67 | /** |
||
68 | * Path to the redis rdb directory, for Debian it's /var/lib/redis/{PORT}/dump.rdb |
||
69 | * |
||
70 | * @var string |
||
71 | */ |
||
72 | private $pathToRedisData; |
||
73 | |||
74 | /** |
||
75 | * Setup. |
||
76 | * |
||
77 | * @see \phpbu\App\Backup\Source |
||
78 | * @param array $conf |
||
79 | * @throws \phpbu\App\Exception |
||
80 | */ |
||
81 | public function setup(array $conf = array()) |
||
95 | 5 | ||
96 | 5 | /** |
|
97 | * Execute the backup. |
||
98 | 5 | * |
|
99 | 1 | * @see \phpbu\App\Backup\Source |
|
100 | * @param \phpbu\App\Backup\Target $target |
||
101 | 4 | * @param \phpbu\App\Result $result |
|
102 | * @return \phpbu\App\Backup\Source\Status |
||
103 | * @throws \phpbu\App\Exception |
||
104 | */ |
||
105 | public function backup(Target $target, Result $result) |
||
126 | 1 | ||
127 | /** |
||
128 | 2 | * Setup the Executable to run the 'tar' command. |
|
129 | * |
||
130 | 1 | * @param \phpbu\App\Backup\Target |
|
131 | * @return \phpbu\App\Cli\Executable |
||
132 | 1 | */ |
|
133 | public function getExecutable(Target $target) |
||
145 | 1 | ||
146 | 1 | /** |
|
147 | 1 | * Creates a RedisLastSave command from a RedisSave command. |
|
148 | 1 | * |
|
149 | 1 | * @param \phpbu\App\Backup\Source\RedisCli $redis |
|
150 | 1 | * @return \phpbu\App\Backup\Source\RedisCli |
|
151 | 4 | */ |
|
152 | public function getRedisLastSave(RedisCli $redis) |
||
158 | |||
159 | /** |
||
160 | * Return last successful save timestamp. |
||
161 | 3 | * |
|
162 | * @param \phpbu\App\Cli\Executable\RedisCli $redis |
||
163 | 3 | * @return int |
|
164 | 3 | * @throws \phpbu\App\Exception |
|
165 | 3 | */ |
|
166 | 3 | private function getLastBackupTime(Executable\RedisCli $redis) |
|
176 | |||
177 | /** |
||
178 | * Check the dump date and return true if BGSAVE is finished. |
||
179 | * |
||
180 | 2 | * @param int $lastTimestamp |
|
181 | * @param \phpbu\App\Cli\Executable\RedisCli $redis |
||
182 | 2 | * @return bool |
|
183 | 2 | * @throws \phpbu\App\Exception |
|
184 | 1 | */ |
|
185 | 1 | private function isDumpCreatedYet($lastTimestamp, $redis) |
|
197 | |||
198 | /** |
||
199 | * Copy the redis RDB file to its backup location. |
||
200 | 1 | * |
|
201 | * @param \phpbu\App\Backup\Target $target |
||
202 | 1 | * @return string |
|
203 | * @throws \phpbu\App\Exception |
||
204 | */ |
||
205 | 1 | private function copyDumpToTargetDir(Target $target) |
|
214 | } |
||
215 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: