@@ -116,7 +116,7 @@ |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | // Get the files matching the database identifier |
119 | - $filesFilter = array_filter($files, function ($item) { |
|
119 | + $filesFilter = array_filter($files, function($item) { |
|
120 | 120 | return strpos($item, $this->database->getRealDatabase()->getDatabaseIdentifier()); |
121 | 121 | }); |
122 | 122 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | try { |
38 | 38 | $reflection = new ReflectionClass($object); |
39 | 39 | } catch (ReflectionException $e) { |
40 | - throw new ReflectionException("Failed setting Protected property. Exception thrown: " . $e->getMessage()); |
|
40 | + throw new ReflectionException("Failed setting Protected property. Exception thrown: ".$e->getMessage()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $reflection_property = $reflection->getProperty($property); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $reflection = new ReflectionClass($object); |
57 | 57 | } catch (ReflectionException $e) { |
58 | - throw new ReflectionException("Failed getting Protected property. Exception thrown: " . $e->getMessage()); |
|
58 | + throw new ReflectionException("Failed getting Protected property. Exception thrown: ".$e->getMessage()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $reflection_property = $reflection->getProperty($property); |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | $process = Process::fromShellCommandline($command, null, null, null, 999.00); |
17 | 17 | |
18 | 18 | $processStatus = true; |
19 | - $process->run(function ($type, $buffer) use ($processStatus): bool { |
|
19 | + $process->run(function($type, $buffer) use ($processStatus): bool { |
|
20 | 20 | if (Process::OUT === $type) { |
21 | - Log::debug('Process buffer: ' . $buffer); |
|
21 | + Log::debug('Process buffer: '.$buffer); |
|
22 | 22 | } |
23 | 23 | if (Process::ERR === $type) { |
24 | 24 | if (!strpos($buffer, '[Warning]')) { |
25 | - Log::error('Error will running processor. Output of buffer: ' . $buffer); |
|
25 | + Log::error('Error will running processor. Output of buffer: '.$buffer); |
|
26 | 26 | $processStatus = false; |
27 | 27 | } |
28 | 28 | } |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | $process = new Process($command); |
43 | 43 | |
44 | 44 | $processStatus = true; |
45 | - $process->run(function ($type, $buffer) use ($processStatus): bool { |
|
45 | + $process->run(function($type, $buffer) use ($processStatus): bool { |
|
46 | 46 | if (Process::OUT === $type) { |
47 | - Log::debug('Success buffer: ' . $buffer); |
|
47 | + Log::debug('Success buffer: '.$buffer); |
|
48 | 48 | } |
49 | 49 | if (Process::ERR === $type) { |
50 | - Log::error('Error whilst performing zip action. Output of buffer: ' . $buffer); |
|
50 | + Log::error('Error whilst performing zip action. Output of buffer: '.$buffer); |
|
51 | 51 | $processStatus = false; |
52 | 52 | } |
53 | 53 |
@@ -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)) { |
@@ -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 | } |
@@ -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 | $this->buildDatabaseClass(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function generateBackupFilename(string $databaseIdentifier, string $databaseFileExtension): string |
90 | 90 | { |
91 | - return $this->backupFilename = $this->storageFolder . $databaseIdentifier . '-' . time() . '.' . $databaseFileExtension; |
|
91 | + return $this->backupFilename = $this->storageFolder.$databaseIdentifier.'-'.time().'.'.$databaseFileExtension; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |