@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | /// @todo inject more randomness in the username, by allowing more chars than bin2hex produces |
| 84 | 84 | |
| 85 | - $userName = 'db3v4l_' . substr(bin2hex(random_bytes(5)), 0, 9); // some mysql versions have a limitation of 16 chars for usernames |
|
| 85 | + $userName = 'db3v4l_'.substr(bin2hex(random_bytes(5)), 0, 9); // some mysql versions have a limitation of 16 chars for usernames |
|
| 86 | 86 | $password = bin2hex(random_bytes(16)); |
| 87 | 87 | //$dbName = bin2hex(random_bytes(31)); |
| 88 | 88 | $dbName = $userName; // $userName will be used as db name |
| 89 | 89 | |
| 90 | 90 | $tempDbSpecs = []; |
| 91 | - foreach($instanceList as $instanceName => $instanceSpecs) { |
|
| 91 | + foreach ($instanceList as $instanceName => $instanceSpecs) { |
|
| 92 | 92 | $tempDbSpecs[$instanceName] = [ |
| 93 | 93 | 'dbname' => $dbName, |
| 94 | 94 | 'user' => $userName, |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if (($charset = $input->getOption('charset')) != '') { |
| 100 | - foreach($instanceList as $instanceName) { |
|
| 100 | + foreach ($instanceList as $instanceName) { |
|
| 101 | 101 | $tempDbSpecs[$instanceName]['charset'] = $charset; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | ]; |
| 125 | 125 | |
| 126 | 126 | $dbConnectionSpecs = []; |
| 127 | - foreach($instanceList as $instanceName => $instanceSpecs) { |
|
| 127 | + foreach ($instanceList as $instanceName => $instanceSpecs) { |
|
| 128 | 128 | $dbConnectionSpecs[$instanceName] = array_merge($instanceSpecs, $dbConfig); |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | if ($createDB) { |
| 140 | 140 | $results['failed'] += $creationResults['failed']; |
| 141 | 141 | |
| 142 | - foreach($instanceList as $instanceName => $instanceSpecs) { |
|
| 142 | + foreach ($instanceList as $instanceName => $instanceSpecs) { |
|
| 143 | 143 | if (!isset($dbConnectionSpecs[$instanceName])) { |
| 144 | 144 | unset($instanceList[$instanceName]); |
| 145 | 145 | } |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | $this->executionStrategy = $previousStrategy; |
| 152 | 152 | } |
| 153 | 153 | } else { |
| 154 | - $results = ['succeeded' => 0, 'failed' => 0, 'data' => null]; |
|
| 154 | + $results = ['succeeded' => 0, 'failed' => 0, 'data' => null]; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $time = microtime(true) - $start; |
| 158 | 158 | |
| 159 | 159 | $this->writeResults($results, $time); |
| 160 | 160 | |
| 161 | - return (int)$results['failed']; |
|
| 161 | + return (int) $results['failed']; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | return $this->executeSqlAction( |
| 177 | 177 | $dbConnectionSpecs, |
| 178 | 178 | 'Execution of SQL', |
| 179 | - function ($schemaManager, $instanceName) use ($sql, $filename) { |
|
| 179 | + function($schemaManager, $instanceName) use ($sql, $filename) { |
|
| 180 | 180 | if ($sql != null) { |
| 181 | 181 | return new Command( |
| 182 | 182 | $sql, |
| 183 | - function ($output, $executor) { |
|
| 183 | + function($output, $executor) { |
|
| 184 | 184 | /** @var TimedExecutor $executor */ |
| 185 | 185 | return array_merge(['stdout' => $output], $executor->getTimingData()); |
| 186 | 186 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | return new File( |
| 195 | 195 | $realFileName, |
| 196 | - function ($output, $executor) { |
|
| 196 | + function($output, $executor) { |
|
| 197 | 197 | /** @var TimedExecutor $executor */ |
| 198 | 198 | return array_merge(['stdout' => $output], $executor->getTimingData()); |
| 199 | 199 | } |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | if (trim($line) !== '') { |
| 229 | 229 | if ($type === 'err') { |
| 230 | 230 | $this->writeErrorln( |
| 231 | - '[' . $processIndex . '][' . $pid . '] ' . trim($line), |
|
| 231 | + '['.$processIndex.']['.$pid.'] '.trim($line), |
|
| 232 | 232 | OutputInterface::VERBOSITY_VERBOSE, |
| 233 | 233 | OutputInterface::OUTPUT_RAW |
| 234 | 234 | ); |
| 235 | 235 | } else { |
| 236 | 236 | $this->writeln( |
| 237 | - '[' . $processIndex . '][' . $pid . '] ' . trim($line), |
|
| 237 | + '['.$processIndex.']['.$pid.'] '.trim($line), |
|
| 238 | 238 | OutputInterface::VERBOSITY_VERBOSE, |
| 239 | 239 | OutputInterface::OUTPUT_RAW |
| 240 | 240 | ); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - foreach($results['data'] as $instanceName => $data) { |
|
| 280 | + foreach ($results['data'] as $instanceName => $data) { |
|
| 281 | 281 | $formattedData = $this->formatResults(array('data' => $data)); |
| 282 | 282 | $outputFile = $this->replaceDBSpecTokens($this->outputFile, $instanceName, $this->dbConfigurationManager->getInstanceConfiguration($instanceName)); |
| 283 | 283 | file_put_contents($outputFile, $formattedData); |