@@ -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 | } |
@@ -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 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // check for mandatory options |
| 74 | 74 | foreach (['user', 'secret', 'container', 'host', 'path'] as $option) { |
| 75 | 75 | if (!Arr::isSetAndNotEmptyString($config, $option)) { |
| 76 | - throw new Exception('SoftLayer ' . $option . ' is mandatory'); |
|
| 76 | + throw new Exception('SoftLayer '.$option.' is mandatory'); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -97,19 +97,19 @@ discard block |
||
| 97 | 97 | public function sync(Target $target, Result $result) |
| 98 | 98 | { |
| 99 | 99 | $sourcePath = $target->getPathname(); |
| 100 | - $targetPath = $this->path . $target->getFilename(); |
|
| 100 | + $targetPath = $this->path.$target->getFilename(); |
|
| 101 | 101 | |
| 102 | 102 | $options = ['adapter' => ObjectStorage_Http_Client::SOCKET, 'timeout' => 20]; |
| 103 | 103 | $objectStorage = new ObjectStorage($this->host, $this->user, $this->secret, $options); |
| 104 | 104 | |
| 105 | - $result->debug('softlayer source: ' . $sourcePath); |
|
| 106 | - $result->debug('softlayer target: ' . $targetPath); |
|
| 105 | + $result->debug('softlayer source: '.$sourcePath); |
|
| 106 | + $result->debug('softlayer target: '.$targetPath); |
|
| 107 | 107 | |
| 108 | 108 | try { |
| 109 | 109 | /** @var \ObjectStorage_Container $container */ |
| 110 | - $container = $objectStorage->with($this->container . $targetPath) |
|
| 110 | + $container = $objectStorage->with($this->container.$targetPath) |
|
| 111 | 111 | ->setLocalFile($sourcePath) |
| 112 | - ->setMeta('description', 'PHPBU Backup: ' . date('r', time())) |
|
| 112 | + ->setMeta('description', 'PHPBU Backup: '.date('r', time())) |
|
| 113 | 113 | ->setHeader('Content-Type', $target->getMimeType()); |
| 114 | 114 | $container->create(); |
| 115 | 115 | } catch (\Exception $e) { |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | public function simulate(Target $target, Result $result) |
| 129 | 129 | { |
| 130 | 130 | $result->debug( |
| 131 | - 'sync backup to SoftLayer' . PHP_EOL |
|
| 132 | - . ' host: ' . $this->host . PHP_EOL |
|
| 133 | - . ' user: ' . $this->user . PHP_EOL |
|
| 134 | - . ' secret: ********' . PHP_EOL |
|
| 135 | - . ' container: ' . $this->container . PHP_EOL |
|
| 136 | - . ' location: ' . $this->path |
|
| 131 | + 'sync backup to SoftLayer'.PHP_EOL |
|
| 132 | + . ' host: '.$this->host.PHP_EOL |
|
| 133 | + . ' user: '.$this->user.PHP_EOL |
|
| 134 | + . ' secret: ********'.PHP_EOL |
|
| 135 | + . ' container: '.$this->container.PHP_EOL |
|
| 136 | + . ' location: '.$this->path |
|
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -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 | |
@@ -477,7 +477,7 @@ |
||
| 477 | 477 | // disable output redirection if files per table is active |
| 478 | 478 | if (!$this->filePerTable) { |
| 479 | 479 | $process->redirectOutputTo( |
| 480 | - $this->dumpPathname . (!empty($this->compression) ? '.' . $this->compression->getSuffix() : '') |
|
| 480 | + $this->dumpPathname.(!empty($this->compression) ? '.'.$this->compression->getSuffix() : '') |
|
| 481 | 481 | ); |
| 482 | 482 | } |
| 483 | 483 | } |
@@ -55,9 +55,9 @@ |
||
| 55 | 55 | public static function getClassName($name) |
| 56 | 56 | { |
| 57 | 57 | if (!isset(self::$availableCompressors[$name])) { |
| 58 | - throw new Exception('Invalid compressor: ' .$name); |
|
| 58 | + throw new Exception('Invalid compressor: '.$name); |
|
| 59 | 59 | } |
| 60 | 60 | $class = self::$availableCompressors[$name]; |
| 61 | - return '\\phpbu\\App\\Backup\\Target\\Compression\\' . $class; |
|
| 61 | + return '\\phpbu\\App\\Backup\\Target\\Compression\\'.$class; |
|
| 62 | 62 | } |
| 63 | 63 | } |
@@ -286,7 +286,7 @@ |
||
| 286 | 286 | { |
| 287 | 287 | if (!isset(self::$classMap[$type])) { |
| 288 | 288 | throw new Exception( |
| 289 | - 'invalid type, please use only \'' . implode('\', \'', array_keys(self::$classMap)) . '\'' |
|
| 289 | + 'invalid type, please use only \''.implode('\', \'', array_keys(self::$classMap)).'\'' |
|
| 290 | 290 | ); |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | protected function getAdapter($name) |
| 78 | 78 | { |
| 79 | 79 | if (!isset($this->adapters[$name])) { |
| 80 | - throw new Exception('no adapter registered with name: ' . $name); |
|
| 80 | + throw new Exception('no adapter registered with name: '.$name); |
|
| 81 | 81 | } |
| 82 | 82 | return $this->adapters[$name]; |
| 83 | 83 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | // make sure the backup should be executed and is not excluded via the --limit option |
| 93 | 93 | if (!$configuration->isBackupActive($backup->getName())) { |
| 94 | - $this->result->debug('skipping backup: ' . $backup->getName() . PHP_EOL); |
|
| 94 | + $this->result->debug('skipping backup: '.$backup->getName().PHP_EOL); |
|
| 95 | 95 | continue; |
| 96 | 96 | } |
| 97 | 97 | // setup target and collector, reset failure state |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $this->executeCleanup($backup, $target, $collector); |
| 137 | 137 | |
| 138 | 138 | } catch (\Exception $e) { |
| 139 | - $this->result->debug('exception: ' . $e->getMessage()); |
|
| 139 | + $this->result->debug('exception: '.$e->getMessage()); |
|
| 140 | 140 | $this->result->addError($e); |
| 141 | 141 | $this->result->backupFailed($backup); |
| 142 | 142 | if ($backup->stopOnFailure()) { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $this->result->cryptSkipped($crypt); |
| 265 | 265 | } else { |
| 266 | 266 | /* @var \phpbu\App\Runner\Crypter $runner */ |
| 267 | - $runner = $this->factory->createRunner('crypter', $this->configuration->isSimulation()); |
|
| 267 | + $runner = $this->factory->createRunner('crypter', $this->configuration->isSimulation()); |
|
| 268 | 268 | $runner->run($this->factory->createCrypter($crypt->type, $crypt->options), $target, $this->result); |
| 269 | 269 | } |
| 270 | 270 | } catch (Backup\Crypter\Exception $e) { |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | { |
| 287 | 287 | /* @var \phpbu\App\Runner\Crypter $runner */ |
| 288 | 288 | /* @var \phpbu\App\Configuration\Backup\Sync $sync */ |
| 289 | - $runner = $this->factory->createRunner('sync', $this->configuration->isSimulation()); |
|
| 289 | + $runner = $this->factory->createRunner('sync', $this->configuration->isSimulation()); |
|
| 290 | 290 | foreach ($backup->getSyncs() as $sync) { |
| 291 | 291 | try { |
| 292 | 292 | $this->result->syncStart($sync); |