@@ -112,7 +112,7 @@ |
||
| 112 | 112 | { |
| 113 | 113 | // remove leading slash |
| 114 | 114 | return (substr($this->path, 0, 1) == '/' ? substr($this->path, 1) : $this->path) |
| 115 | - . (substr($this->path, -1, 1) == '/' ? '' : '/') |
|
| 116 | - . $target->getFilename(); |
|
| 115 | + . (substr($this->path, -1, 1) == '/' ? '' : '/') |
|
| 116 | + . $target->getFilename(); |
|
| 117 | 117 | } |
| 118 | 118 | } |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $s3->registerStreamWrapper(); |
| 64 | 64 | $source = $this->getFileHandle($target->getPathname(), 'r'); |
| 65 | - $stream = $this->getFileHandle('s3://' . $this->bucket . '/' . $this->getUploadPath($target), 'w'); |
|
| 66 | - while(!feof($source)) { |
|
| 65 | + $stream = $this->getFileHandle('s3://'.$this->bucket.'/'.$this->getUploadPath($target), 'w'); |
|
| 66 | + while (!feof($source)) { |
|
| 67 | 67 | fwrite($stream, fread($source, 4096)); |
| 68 | 68 | } |
| 69 | 69 | fclose($stream); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $handle = fopen($path, $mode); |
| 99 | 99 | if (!is_resource($handle)) { |
| 100 | - throw new Exception('fopen failed: could not open stream ' . $path); |
|
| 100 | + throw new Exception('fopen failed: could not open stream '.$path); |
|
| 101 | 101 | } |
| 102 | 102 | return $handle; |
| 103 | 103 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $result->debug($rsync->getCmd()); |
| 51 | 51 | |
| 52 | 52 | if (!$rsync->wasSuccessful()) { |
| 53 | - throw new Exception('rsync failed:' . $rsync->getStdErr()); |
|
| 53 | + throw new Exception('rsync failed:'.$rsync->getStdErr()); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $this->createStatus($target); |
@@ -76,11 +76,11 @@ |
||
| 76 | 76 | ); |
| 77 | 77 | } else { |
| 78 | 78 | $this->executable->fromHost($this->host) |
| 79 | - ->fromUser($this->user) |
|
| 80 | - ->fromPath($this->path) |
|
| 81 | - ->toPath($this->getRsyncLocation($target, true)) |
|
| 82 | - ->removeDeleted($this->delete) |
|
| 83 | - ->exclude($this->excludes); |
|
| 79 | + ->fromUser($this->user) |
|
| 80 | + ->fromPath($this->path) |
|
| 81 | + ->toPath($this->getRsyncLocation($target, true)) |
|
| 82 | + ->removeDeleted($this->delete) |
|
| 83 | + ->exclude($this->excludes); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | return $this->executable; |
@@ -216,7 +216,7 @@ |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // use archive mode, verbose and compress if not already done |
| 219 | - $options = '-av' . ($this->compressed ? 'z' : ''); |
|
| 219 | + $options = '-av'.($this->compressed ? 'z' : ''); |
|
| 220 | 220 | $cmd->addOption($options); |
| 221 | 221 | |
| 222 | 222 | if (count($this->excludes)) { |
@@ -102,9 +102,9 @@ |
||
| 102 | 102 | if (null !== $this->host) { |
| 103 | 103 | // remote user |
| 104 | 104 | if (null !== $this->user) { |
| 105 | - $return .= $this->user . '@'; |
|
| 105 | + $return .= $this->user.'@'; |
|
| 106 | 106 | } |
| 107 | - $return .= $this->host . ':'; |
|
| 107 | + $return .= $this->host.':'; |
|
| 108 | 108 | } |
| 109 | 109 | $return .= $this->path; |
| 110 | 110 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | if ($file->getPathname() == $this->target->getPathname()) { |
| 108 | 108 | continue; |
| 109 | 109 | } |
| 110 | - if (preg_match('#' . $this->fileRegex . '#i', $file->getFilename())) { |
|
| 111 | - $index = date('YmdHis', $file->getMTime()) . '-' . $i . '-' . $file->getPathname(); |
|
| 110 | + if (preg_match('#'.$this->fileRegex.'#i', $file->getFilename())) { |
|
| 111 | + $index = date('YmdHis', $file->getMTime()).'-'.$i.'-'.$file->getPathname(); |
|
| 112 | 112 | $this->files[$index] = new File($file->getFileInfo()); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -137,6 +137,6 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | $dirTarget = Arr::getValue($this->target->getChangingPathElements(), $depth); |
| 139 | 139 | $dirRegex = Str::datePlaceholdersToRegex($dirTarget); |
| 140 | - return preg_match('#' . $dirRegex . '#i', $dir); |
|
| 140 | + return preg_match('#'.$dirRegex.'#i', $dir); |
|
| 141 | 141 | } |
| 142 | 142 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // check for mandatory options |
| 102 | 102 | foreach (['key', 'secret', 'bucket', 'region', 'path'] as $option) { |
| 103 | 103 | if (!Arr::isSetAndNotEmptyString($config, $option)) { |
| 104 | - throw new Exception('AWS S3 ' . $option . ' is mandatory'); |
|
| 104 | + throw new Exception('AWS S3 '.$option.' is mandatory'); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | public function simulate(Target $target, Result $result) |
| 134 | 134 | { |
| 135 | 135 | $result->debug( |
| 136 | - 'sync backup to Amazon S3' . PHP_EOL |
|
| 137 | - . ' region: ' . $this->region . PHP_EOL |
|
| 138 | - . ' key: ' . $this->key . PHP_EOL |
|
| 139 | - . ' secret: ********' . PHP_EOL |
|
| 140 | - . ' location: ' . $this->bucket |
|
| 136 | + 'sync backup to Amazon S3'.PHP_EOL |
|
| 137 | + . ' region: '.$this->region.PHP_EOL |
|
| 138 | + . ' key: '.$this->key.PHP_EOL |
|
| 139 | + . ' secret: ********'.PHP_EOL |
|
| 140 | + . ' location: '.$this->bucket |
|
| 141 | 141 | ); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -71,10 +71,10 @@ |
||
| 71 | 71 | $this->executable = new Tar($this->pathToCommand); |
| 72 | 72 | $this->executable->archiveDirectory($this->path); |
| 73 | 73 | $this->executable->archiveTo($this->getArchiveFile($target)) |
| 74 | - ->useCompression( |
|
| 75 | - $target->shouldBeCompressed() ? $target->getCompression()->getCommand() : '' |
|
| 76 | - ) |
|
| 77 | - ->removeSourceDirectory(true); |
|
| 74 | + ->useCompression( |
|
| 75 | + $target->shouldBeCompressed() ? $target->getCompression()->getCommand() : '' |
|
| 76 | + ) |
|
| 77 | + ->removeSourceDirectory(true); |
|
| 78 | 78 | } |
| 79 | 79 | return $this->executable; |
| 80 | 80 | } |
@@ -60,14 +60,14 @@ |
||
| 60 | 60 | public function compress(Target $target, Result $result) |
| 61 | 61 | { |
| 62 | 62 | if (!$this->isPathValid($this->path)) { |
| 63 | - throw new Exception('path to compress should be valid: ' . $this->path); |
|
| 63 | + throw new Exception('path to compress should be valid: '.$this->path); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $res = $this->execute($target); |
| 67 | 67 | $result->debug($res->getCmd()); |
| 68 | 68 | |
| 69 | 69 | if (0 !== $res->getCode()) { |
| 70 | - throw new Exception('Failed to \'compress\' file: ' . $this->path); |
|
| 70 | + throw new Exception('Failed to \'compress\' file: '.$this->path); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return $this->getArchiveFile($target); |
@@ -291,7 +291,7 @@ |
||
| 291 | 291 | public function getFilenameSuffix($plain = false) |
| 292 | 292 | { |
| 293 | 293 | return (count($this->fileSuffixes) ? '.' . implode('.', $this->fileSuffixes) : '') |
| 294 | - . ($plain ? '' : $this->getCompressionSuffix() . $this->getCrypterSuffix()); |
|
| 294 | + . ($plain ? '' : $this->getCompressionSuffix() . $this->getCrypterSuffix()); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $this->pathElementsChanging[] = $d; |
| 159 | 159 | $foundChangingElement = true; |
| 160 | 160 | } else { |
| 161 | - $this->pathNotChanging .= DIRECTORY_SEPARATOR . $d; |
|
| 161 | + $this->pathNotChanging .= DIRECTORY_SEPARATOR.$d; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | // replace potential date placeholder |
@@ -290,8 +290,8 @@ discard block |
||
| 290 | 290 | */ |
| 291 | 291 | public function getFilenameSuffix($plain = false) |
| 292 | 292 | { |
| 293 | - return (count($this->fileSuffixes) ? '.' . implode('.', $this->fileSuffixes) : '') |
|
| 294 | - . ($plain ? '' : $this->getCompressionSuffix() . $this->getCrypterSuffix()); |
|
| 293 | + return (count($this->fileSuffixes) ? '.'.implode('.', $this->fileSuffixes) : '') |
|
| 294 | + . ($plain ? '' : $this->getCompressionSuffix().$this->getCrypterSuffix()); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | public function getCompressionSuffix() |
| 303 | 303 | { |
| 304 | - return $this->shouldBeCompressed() ? '.' . $this->compression->getSuffix() : ''; |
|
| 304 | + return $this->shouldBeCompressed() ? '.'.$this->compression->getSuffix() : ''; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function getCrypterSuffix() |
| 313 | 313 | { |
| 314 | - return $this->shouldBeEncrypted() ? '.' . $this->crypter->getSuffix() : ''; |
|
| 314 | + return $this->shouldBeEncrypted() ? '.'.$this->crypter->getSuffix() : ''; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | public function getPathname($plain = false) |
| 403 | 403 | { |
| 404 | - return $this->path . DIRECTORY_SEPARATOR . $this->getFilename($plain); |
|
| 404 | + return $this->path.DIRECTORY_SEPARATOR.$this->getFilename($plain); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /** |