@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->fileExtension = 'sql'; |
42 | 42 | $this->databaseIdentifier = 'mysql'; |
43 | 43 | |
44 | - $this->processHandler=$processHandler; |
|
44 | + $this->processHandler = $processHandler; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | Log::debug('Starting MySQL import procedure.'); |
99 | 99 | |
100 | 100 | $startTimeImport = microtime(true); |
101 | - $backupFile = '"' . addcslashes($backupFile, '\\"') . '"'; |
|
101 | + $backupFile = '"'.addcslashes($backupFile, '\\"').'"'; |
|
102 | 102 | $command = sprintf('mysql %s %s < %s', $this->getCredentials(), $this->database, $backupFile); |
103 | 103 | |
104 | 104 | if (false === $this->processHandler->run($command)) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function __construct() |
36 | 36 | { |
37 | 37 | $this->database = Config::get('database.default'); |
38 | - $this->realDatabase = Config::get('database.connections.' . $this->database); |
|
38 | + $this->realDatabase = Config::get('database.connections.'.$this->database); |
|
39 | 39 | $this->processHandler = new ProcessHandler(); |
40 | 40 | |
41 | 41 | // Check if the current database driver is supported |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function generateBackupFilename(string $databaseIdentifier, string $databaseFileExtension): string |
86 | 86 | { |
87 | - return $this->backupFilename = $this->storageFolder . $databaseIdentifier . '-' . time() . '.' . $databaseFileExtension; |
|
87 | + return $this->backupFilename = $this->storageFolder.$databaseIdentifier.'-'.time().'.'.$databaseFileExtension; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $configStoragePath = Config::get('db-backup.backup_folder'); |
30 | 30 | if (substr($configStoragePath, -1, 1) !== DIRECTORY_SEPARATOR) { |
31 | 31 | Log::debug('Stored back-up folder is not probably set. Fixing.'); |
32 | - $configStoragePath = $configStoragePath . DIRECTORY_SEPARATOR; |
|
32 | + $configStoragePath = $configStoragePath.DIRECTORY_SEPARATOR; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return $configStoragePath; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function generateBackupFilename(string $databaseIdentifier, string $databaseFileExtension): string |
66 | 66 | { |
67 | - return $this->backupFilename = $this->storagePath . $databaseIdentifier . '-' . time() . '.' . $databaseFileExtension; |
|
67 | + return $this->backupFilename = $this->storagePath.$databaseIdentifier.'-'.time().'.'.$databaseFileExtension; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $process = new Process(['gzip', '-d', $workableFile]); |
86 | - $process->run(function ($type, $buffer): bool { |
|
86 | + $process->run(function($type, $buffer): bool { |
|
87 | 87 | if (Process::OUT === $type) { |
88 | - Log::debug('gzip buffer: ' . $buffer); |
|
88 | + Log::debug('gzip buffer: '.$buffer); |
|
89 | 89 | } |
90 | 90 | if (Process::ERR === $type) { |
91 | - Log::error('Error whilst performing zip action. Output of buffer: ' . $buffer); |
|
91 | + Log::error('Error whilst performing zip action. Output of buffer: '.$buffer); |
|
92 | 92 | |
93 | 93 | return false; |
94 | 94 | } |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | protected function createTmpFile(string $backupFile, Database $database): ?string |
110 | 110 | { |
111 | 111 | Log::debug('Creating temp back-up file to not corrupt the archives.'); |
112 | - $tmpFilename = 'tmp.' . microtime(true) . '.' . $database->getRealDatabase()->getFileExtension() . '.gz'; |
|
113 | - $filePath = $this->storagePath . $tmpFilename; |
|
112 | + $tmpFilename = 'tmp.'.microtime(true).'.'.$database->getRealDatabase()->getFileExtension().'.gz'; |
|
113 | + $filePath = $this->storagePath.$tmpFilename; |
|
114 | 114 | |
115 | 115 | try { |
116 | 116 | File::copy($backupFile, $filePath); |
117 | 117 | } catch (Exception $e) { |
118 | - Log::error('Could not create temporary archive file. Exception throw: ' . $e->getMessage()); |
|
118 | + Log::error('Could not create temporary archive file. Exception throw: '.$e->getMessage()); |
|
119 | 119 | |
120 | 120 | return null; |
121 | 121 | } |