@@ -130,10 +130,10 @@ |
||
130 | 130 | if (null == $this->executable) { |
131 | 131 | $this->executable = new Executable\Elasticdump($this->pathToElasticdump); |
132 | 132 | $this->executable->useHost($this->host) |
133 | - ->credentials($this->user, $this->password) |
|
134 | - ->dumpIndex($this->index) |
|
135 | - ->dumpType($this->type) |
|
136 | - ->dumpTo($target->getPathnamePlain()); |
|
133 | + ->credentials($this->user, $this->password) |
|
134 | + ->dumpIndex($this->index) |
|
135 | + ->dumpType($this->type) |
|
136 | + ->dumpTo($target->getPathnamePlain()); |
|
137 | 137 | } |
138 | 138 | return $this->executable; |
139 | 139 | } |
@@ -111,7 +111,7 @@ |
||
111 | 111 | $result->debug($this->getExecutable($target)->getCommandLinePrintable()); |
112 | 112 | |
113 | 113 | if (!$elasticdump->wasSuccessful()) { |
114 | - throw new Exception('elasticdump failed: ' . $elasticdump->getStdErr()); |
|
114 | + throw new Exception('elasticdump failed: '.$elasticdump->getStdErr()); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | return $this->createStatus($target); |
@@ -178,13 +178,13 @@ |
||
178 | 178 | if (null == $this->executable) { |
179 | 179 | $this->executable = new Executable\Mongodump($this->pathToMongodump); |
180 | 180 | $this->executable->dumpToDirectory($this->getDumpDir($target)) |
181 | - ->useIpv6($this->useIPv6) |
|
182 | - ->useHost($this->host) |
|
183 | - ->credentials($this->user, $this->password, $this->authenticationDatabase) |
|
184 | - ->dumpDatabases($this->databases) |
|
185 | - ->dumpCollections($this->collections) |
|
186 | - ->excludeCollections($this->excludeCollections) |
|
187 | - ->excludeCollectionsWithPrefix($this->excludeCollectionsWithPrefix); |
|
181 | + ->useIpv6($this->useIPv6) |
|
182 | + ->useHost($this->host) |
|
183 | + ->credentials($this->user, $this->password, $this->authenticationDatabase) |
|
184 | + ->dumpDatabases($this->databases) |
|
185 | + ->dumpCollections($this->collections) |
|
186 | + ->excludeCollections($this->excludeCollections) |
|
187 | + ->excludeCollectionsWithPrefix($this->excludeCollectionsWithPrefix); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | return $this->executable; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $result->debug($this->getExecutable($target)->getCommandLinePrintable()); |
161 | 161 | |
162 | 162 | if (!$mongodump->wasSuccessful()) { |
163 | - throw new Exception('mongodump failed: ' . $mongodump->getStdErr()); |
|
163 | + throw new Exception('mongodump failed: '.$mongodump->getStdErr()); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return $this->createStatus($target); |
@@ -208,6 +208,6 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function getDumpDir(Target $target) |
210 | 210 | { |
211 | - return $target->getPath() . '/dump'; |
|
211 | + return $target->getPath().'/dump'; |
|
212 | 212 | } |
213 | 213 | } |
@@ -127,9 +127,9 @@ |
||
127 | 127 | if (null == $this->executable) { |
128 | 128 | $this->executable = new Executable\RedisCli($this->pathToRedisCli); |
129 | 129 | $this->executable->backup() |
130 | - ->useHost($this->host) |
|
131 | - ->usePort($this->port) |
|
132 | - ->usePassword($this->password); |
|
130 | + ->useHost($this->host) |
|
131 | + ->usePort($this->port) |
|
132 | + ->usePassword($this->password); |
|
133 | 133 | } |
134 | 134 | return $this->executable; |
135 | 135 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $saveResult = $redisSave->run(); |
107 | 107 | $result->debug($this->getExecutable($target)->getCommandLinePrintable()); |
108 | 108 | if (!$saveResult->wasSuccessful()) { |
109 | - throw new Exception('redis-cli BGSAVE failed:' . $saveResult->getStdErr()); |
|
109 | + throw new Exception('redis-cli BGSAVE failed:'.$saveResult->getStdErr()); |
|
110 | 110 | } |
111 | 111 | // check if the save process is finished |
112 | 112 | $this->isDumpCreatedYet($lastBackupTimestamp, $redisLast); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | private function copyDumpToTarget(Target $target) |
196 | 196 | { |
197 | 197 | if (!file_exists($this->pathToRedisData)) { |
198 | - throw new Exception('Redis data not found at: \'' . $this->pathToRedisCli . '\''); |
|
198 | + throw new Exception('Redis data not found at: \''.$this->pathToRedisCli.'\''); |
|
199 | 199 | } |
200 | 200 | $targetFile = $target->getPathnamePlain(); |
201 | 201 | copy($this->pathToRedisData, $targetFile); |
@@ -263,20 +263,20 @@ |
||
263 | 263 | if (null == $this->executable) { |
264 | 264 | $this->executable = new Executable\Pgdump($this->pathToPgdump); |
265 | 265 | $this->executable->credentials($this->user, $this->password) |
266 | - ->useHost($this->host) |
|
267 | - ->usePort($this->port) |
|
268 | - ->dumpDatabase($this->database) |
|
269 | - ->dumpSchemas($this->schemas) |
|
270 | - ->excludeSchemas($this->excludeSchemas) |
|
271 | - ->dumpTables($this->tables) |
|
272 | - ->excludeTables($this->excludeTables) |
|
273 | - ->excludeTableData($this->excludeTableData) |
|
274 | - ->dumpSchemaOnly($this->schemaOnly) |
|
275 | - ->dumpDataOnly($this->dataOnly) |
|
276 | - ->dumpNoPrivileges($this->noPrivileges) |
|
277 | - ->dumpNoOwner($this->noOwner) |
|
278 | - ->dumpFormat($this->format) |
|
279 | - ->dumpTo($target->getPathnamePlain()); |
|
266 | + ->useHost($this->host) |
|
267 | + ->usePort($this->port) |
|
268 | + ->dumpDatabase($this->database) |
|
269 | + ->dumpSchemas($this->schemas) |
|
270 | + ->excludeSchemas($this->excludeSchemas) |
|
271 | + ->dumpTables($this->tables) |
|
272 | + ->excludeTables($this->excludeTables) |
|
273 | + ->excludeTableData($this->excludeTableData) |
|
274 | + ->dumpSchemaOnly($this->schemaOnly) |
|
275 | + ->dumpDataOnly($this->dataOnly) |
|
276 | + ->dumpNoPrivileges($this->noPrivileges) |
|
277 | + ->dumpNoOwner($this->noOwner) |
|
278 | + ->dumpFormat($this->format) |
|
279 | + ->dumpTo($target->getPathnamePlain()); |
|
280 | 280 | } |
281 | 281 | return $this->executable; |
282 | 282 | } |
@@ -246,7 +246,7 @@ |
||
246 | 246 | $result->debug($this->getExecutable($target)->getCommandLinePrintable()); |
247 | 247 | |
248 | 248 | if (!$pgDump->wasSuccessful()) { |
249 | - throw new Exception('mysqldump failed:' . $pgDump->getStdErr()); |
|
249 | + throw new Exception('mysqldump failed:'.$pgDump->getStdErr()); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $this->createStatus($target); |
@@ -5,8 +5,6 @@ |
||
5 | 5 | use phpbu\App\Result; |
6 | 6 | use phpbu\App\Backup\Sync; |
7 | 7 | use phpbu\App\Backup\Target; |
8 | -use phpbu\App\Util\Arr; |
|
9 | -use phpbu\App\Util\Str; |
|
10 | 8 | |
11 | 9 | /** |
12 | 10 | * Amazon S3 Sync |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function sync(Target $target, Result $result) |
33 | 33 | { |
34 | 34 | $sourcePath = $target->getPathname(); |
35 | - $targetPath = $this->path . $target->getFilename(); |
|
35 | + $targetPath = $this->path.$target->getFilename(); |
|
36 | 36 | |
37 | 37 | $s3 = S3Client::factory( |
38 | 38 | [ |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public static function withTrailingSlash($string) |
187 | 187 | { |
188 | - return $string . (substr($string, -1) !== '/' ? '/' : ''); |
|
188 | + return $string.(substr($string, -1) !== '/' ? '/' : ''); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public static function withLeadingSlash($string) |
209 | 209 | { |
210 | - return (substr($string, 0, 1) !== '/' ? '/' : '') . $string; |
|
210 | + return (substr($string, 0, 1) !== '/' ? '/' : '').$string; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -230,6 +230,6 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public static function appendPluralS($subject, $amount) |
232 | 232 | { |
233 | - return $subject . ($amount == 1 ? '' : (substr($subject, -1) == 's' ? '\'s' : 's')); |
|
233 | + return $subject.($amount == 1 ? '' : (substr($subject, -1) == 's' ? '\'s' : 's')); |
|
234 | 234 | } |
235 | 235 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'mongodump' => [], |
50 | 50 | 'mysqldump' => [ |
51 | 51 | '/usr/local/mysql/bin', // Mac OS X |
52 | - '/usr/mysql/bin', // Linux |
|
52 | + '/usr/mysql/bin', // Linux |
|
53 | 53 | ], |
54 | 54 | 'tar' => [], |
55 | 55 | ]; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function detectCmdLocationInPath($cmd, $path) |
158 | 158 | { |
159 | - $command = $path . DIRECTORY_SEPARATOR . $cmd; |
|
159 | + $command = $path.DIRECTORY_SEPARATOR.$cmd; |
|
160 | 160 | $bin = self::isExecutable($command); |
161 | 161 | if (null === $bin) { |
162 | 162 | throw new RuntimeException(sprintf('wrong path specified for \'%s\': %s', $cmd, $path)); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public static function detectCmdLocationInPaths($cmd, array $paths) |
193 | 193 | { |
194 | 194 | foreach ($paths as $path) { |
195 | - $command = $path . DIRECTORY_SEPARATOR . $cmd; |
|
195 | + $command = $path.DIRECTORY_SEPARATOR.$cmd; |
|
196 | 196 | $bin = self::isExecutable($command); |
197 | 197 | if (null !== $bin) { |
198 | 198 | return $bin; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | return $path; |
299 | 299 | } |
300 | 300 | |
301 | - $file = $base . DIRECTORY_SEPARATOR . $path; |
|
301 | + $file = $base.DIRECTORY_SEPARATOR.$path; |
|
302 | 302 | |
303 | 303 | if ($useIncludePath && !file_exists($file)) { |
304 | 304 | $includePathFile = stream_resolve_include_path($path); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | $styledLines = []; |
333 | 333 | foreach ($lines as $line) { |
334 | - $styledLines[] = strlen($line) ? $style . str_pad($line, $padding) . "\x1b[0m" : ''; |
|
334 | + $styledLines[] = strlen($line) ? $style.str_pad($line, $padding)."\x1b[0m" : ''; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | return implode(PHP_EOL, $styledLines); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public static function formatWithAsterisk($buffer, $length = 75) |
348 | 348 | { |
349 | - return $buffer . str_repeat('*', $length - strlen($buffer)) . PHP_EOL; |
|
349 | + return $buffer.str_repeat('*', $length - strlen($buffer)).PHP_EOL; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | if ('.' === $file || '..' === $file) { |
361 | 361 | continue; |
362 | 362 | } |
363 | - if (is_dir($dir . '/' . $file)) { |
|
364 | - self::removeDir($dir . '/' . $file); |
|
363 | + if (is_dir($dir.'/'.$file)) { |
|
364 | + self::removeDir($dir.'/'.$file); |
|
365 | 365 | } else { |
366 | - unlink($dir . '/' . $file); |
|
366 | + unlink($dir.'/'.$file); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | rmdir($dir); |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $crypt = $this->execute($target); |
34 | 34 | $name = strtolower(get_class($this)); |
35 | 35 | |
36 | - $result->debug($name . ':' . $this->getExecutable($target)->getCommandLinePrintable()); |
|
36 | + $result->debug($name.':'.$this->getExecutable($target)->getCommandLinePrintable()); |
|
37 | 37 | |
38 | 38 | if (!$crypt->wasSuccessful()) { |
39 | - throw new Exception($name . ' failed:' . PHP_EOL . $crypt->getStdErr()); |
|
39 | + throw new Exception($name.' failed:'.PHP_EOL.$crypt->getStdErr()); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function simulate(Target $target, Result $result) |
50 | 50 | { |
51 | 51 | $result->debug( |
52 | - 'execute encryption:' . PHP_EOL . |
|
52 | + 'execute encryption:'.PHP_EOL. |
|
53 | 53 | $this->getExecutable($target)->getCommandLinePrintable() |
54 | 54 | ); |
55 | 55 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $result->debug($rsync->getCmd()); |
130 | 130 | |
131 | 131 | if (!$rsync->wasSuccessful()) { |
132 | - throw new Exception('rsync failed: ' . $rsync->getStdErr()); |
|
132 | + throw new Exception('rsync failed: '.$rsync->getStdErr()); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function simulate(Target $target, Result $result) |
144 | 144 | { |
145 | 145 | $result->debug( |
146 | - 'sync backup with rsync' . PHP_EOL |
|
146 | + 'sync backup with rsync'.PHP_EOL |
|
147 | 147 | . $this->getExecutable($target)->getCommandLine() |
148 | 148 | ); |
149 | 149 | } |
@@ -97,12 +97,12 @@ |
||
97 | 97 | ); |
98 | 98 | } else { |
99 | 99 | $this->executable->fromPath($this->getRsyncLocation($target)) |
100 | - ->toHost($this->host) |
|
101 | - ->toPath($this->path) |
|
102 | - ->toUser($this->user) |
|
103 | - ->compressed(!$target->shouldBeCompressed()) |
|
104 | - ->removeDeleted($this->delete) |
|
105 | - ->exclude($this->excludes); |
|
100 | + ->toHost($this->host) |
|
101 | + ->toPath($this->path) |
|
102 | + ->toUser($this->user) |
|
103 | + ->compressed(!$target->shouldBeCompressed()) |
|
104 | + ->removeDeleted($this->delete) |
|
105 | + ->exclude($this->excludes); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | return $this->executable; |