@@ -142,11 +142,11 @@ |
||
| 142 | 142 | if (null == $this->executable) { |
| 143 | 143 | $this->executable = new Executable\Innobackupex($this->pathToXtraBackup); |
| 144 | 144 | $this->executable->useHost($this->host) |
| 145 | - ->credentials($this->user, $this->password) |
|
| 146 | - ->dumpDatabases($this->databases) |
|
| 147 | - ->including($this->include) |
|
| 148 | - ->dumpFrom($this->dataDir) |
|
| 149 | - ->dumpTo($this->getDumpDir($target)); |
|
| 145 | + ->credentials($this->user, $this->password) |
|
| 146 | + ->dumpDatabases($this->databases) |
|
| 147 | + ->including($this->include) |
|
| 148 | + ->dumpFrom($this->dataDir) |
|
| 149 | + ->dumpTo($this->getDumpDir($target)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $this->executable; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $result->debug($this->getExecutable($target)->getCommandLinePrintable()); |
| 124 | 124 | |
| 125 | 125 | if (!$innobackupex->wasSuccessful()) { |
| 126 | - throw new Exception('XtraBackup failed: ' . $innobackupex->getStdErr()); |
|
| 126 | + throw new Exception('XtraBackup failed: '.$innobackupex->getStdErr()); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return $this->createStatus($target); |
@@ -170,6 +170,6 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function getDumpDir(Target $target) |
| 172 | 172 | { |
| 173 | - return $target->getPath() . '/dump'; |
|
| 173 | + return $target->getPath().'/dump'; |
|
| 174 | 174 | } |
| 175 | 175 | } |
@@ -160,13 +160,13 @@ |
||
| 160 | 160 | if (null == $this->executable) { |
| 161 | 161 | $this->executable = new Executable\Arangodump($this->pathToArangodump); |
| 162 | 162 | $this->executable->useEndpoint($this->endpoint) |
| 163 | - ->credentials($this->username, $this->password) |
|
| 164 | - ->dumpDatabase($this->database) |
|
| 165 | - ->dumpCollections($this->collections) |
|
| 166 | - ->disableAuthentication($this->disableAuthentication) |
|
| 167 | - ->includeSystemCollections($this->includeSystemCollections) |
|
| 168 | - ->dumpData($this->dumpData) |
|
| 169 | - ->dumpTo($this->getDumpDir($target)); |
|
| 163 | + ->credentials($this->username, $this->password) |
|
| 164 | + ->dumpDatabase($this->database) |
|
| 165 | + ->dumpCollections($this->collections) |
|
| 166 | + ->disableAuthentication($this->disableAuthentication) |
|
| 167 | + ->includeSystemCollections($this->includeSystemCollections) |
|
| 168 | + ->dumpData($this->dumpData) |
|
| 169 | + ->dumpTo($this->getDumpDir($target)); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return $this->executable; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $result->debug($this->getExecutable($target)->getCommandLinePrintable()); |
| 142 | 142 | |
| 143 | 143 | if (!$arangodump->wasSuccessful()) { |
| 144 | - throw new Exception('arangodump failed: ' . $arangodump->getStdErr()); |
|
| 144 | + throw new Exception('arangodump failed: '.$arangodump->getStdErr()); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return $this->createStatus($target); |
@@ -190,6 +190,6 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function getDumpDir(Target $target) |
| 192 | 192 | { |
| 193 | - return $target->getPath() . '/dump'; |
|
| 193 | + return $target->getPath().'/dump'; |
|
| 194 | 194 | } |
| 195 | 195 | } |
@@ -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); |
@@ -397,7 +397,7 @@ |
||
| 397 | 397 | * Do not dump commands setting ownership. |
| 398 | 398 | * --no-owner |
| 399 | 399 | * |
| 400 | - * @param $bool |
|
| 400 | + * @param boolean $bool |
|
| 401 | 401 | * @return \phpbu\App\Cli\Executable\Pgdump |
| 402 | 402 | */ |
| 403 | 403 | public function dumpNoOwner($bool) |
@@ -453,8 +453,8 @@ |
||
| 453 | 453 | protected function createProcess() |
| 454 | 454 | { |
| 455 | 455 | $process = new Process(); |
| 456 | - $password = $this->password ? 'PGPASSWORD=' . escapeshellarg($this->password) . ' ' : ''; |
|
| 457 | - $cmd = new Cmd($password . $this->binary); |
|
| 456 | + $password = $this->password ? 'PGPASSWORD='.escapeshellarg($this->password).' ' : ''; |
|
| 457 | + $cmd = new Cmd($password.$this->binary); |
|
| 458 | 458 | $process->addCommand($cmd); |
| 459 | 459 | |
| 460 | 460 | // always disable password prompt |
@@ -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 | [ |
@@ -68,9 +68,9 @@ |
||
| 68 | 68 | public function getUploadPath(Target $target) |
| 69 | 69 | { |
| 70 | 70 | return 's3://' . $this->bucket |
| 71 | - . (substr($this->path, 0, 1) == '/' ? '' : '/') |
|
| 72 | - . $this->path |
|
| 73 | - . (substr($this->path, -1, 1) == '/' ? '' : '/') |
|
| 74 | - . $target->getFilename(); |
|
| 71 | + . (substr($this->path, 0, 1) == '/' ? '' : '/') |
|
| 72 | + . $this->path |
|
| 73 | + . (substr($this->path, -1, 1) == '/' ? '' : '/') |
|
| 74 | + . $target->getFilename(); |
|
| 75 | 75 | } |
| 76 | 76 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $stream = $this->getFileHandle($this->getUploadPath($target), 'w'); |
| 44 | 44 | |
| 45 | 45 | try { |
| 46 | - while(!feof($source)) { |
|
| 46 | + while (!feof($source)) { |
|
| 47 | 47 | fwrite($stream, fread($source, 4096)); |
| 48 | 48 | } |
| 49 | 49 | fclose($stream); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $handle = fopen($path, $mode); |
| 68 | 68 | if (!is_resource($handle)) { |
| 69 | - throw new Exception('fopen failed: could not open stream ' . $path); |
|
| 69 | + throw new Exception('fopen failed: could not open stream '.$path); |
|
| 70 | 70 | } |
| 71 | 71 | return $handle; |
| 72 | 72 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function getUploadPath(Target $target) |
| 81 | 81 | { |
| 82 | - return 's3://' . $this->bucket |
|
| 82 | + return 's3://'.$this->bucket |
|
| 83 | 83 | . (substr($this->path, 0, 1) == '/' ? '' : '/') |
| 84 | 84 | . $this->path |
| 85 | 85 | . (substr($this->path, -1, 1) == '/' ? '' : '/') |