@@ -12,7 +12,7 @@ |
||
| 12 | 12 | public function buildCommandLine($command, array $arguments = array()) |
| 13 | 13 | { |
| 14 | 14 | $arguments = array_map('escapeshellarg', $arguments); |
| 15 | - return escapeshellcmd($command) . ' ' . implode(' ', $arguments); |
|
| 15 | + return escapeshellcmd($command).' '.implode(' ', $arguments); |
|
| 16 | 16 | |
| 17 | 17 | return new Process($commandLine, null, $env); |
| 18 | 18 | } |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | $options = [ |
| 51 | 51 | 'bin/dbconsole', |
| 52 | 52 | 'sql:execute', |
| 53 | - '--only-instances=' . $this->instanceName, |
|
| 53 | + '--only-instances='.$this->instanceName, |
|
| 54 | 54 | '--execute-in-process', |
| 55 | - '--execution-strategy=' . static::EXECUTION_STRATEGY, |
|
| 55 | + '--execution-strategy='.static::EXECUTION_STRATEGY, |
|
| 56 | 56 | '--output-type=json', |
| 57 | 57 | ]; |
| 58 | 58 | |
| 59 | 59 | switch ($action) { |
| 60 | 60 | case self::EXECUTE_COMMAND: |
| 61 | - $options[] = '--sql=' . $sqlOrFilename; |
|
| 61 | + $options[] = '--sql='.$sqlOrFilename; |
|
| 62 | 62 | break; |
| 63 | 63 | case self::EXECUTE_FILE: |
| 64 | - $options[] = '--file=' . $sqlOrFilename; |
|
| 64 | + $options[] = '--file='.$sqlOrFilename; |
|
| 65 | 65 | break; |
| 66 | 66 | default: |
| 67 | 67 | throw new \OutOfBoundsException('Unsupported action: $action'); |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | /// @todo add support for charset ? |
| 73 | 73 | if ($instanceConfiguration != $this->databaseConfiguration) { |
| 74 | 74 | if (isset($this->databaseConfiguration['dbname'])) { |
| 75 | - $options[] = '--database=' . $this->databaseConfiguration['dbname']; |
|
| 75 | + $options[] = '--database='.$this->databaseConfiguration['dbname']; |
|
| 76 | 76 | } |
| 77 | 77 | if (isset($this->databaseConfiguration['user'])) { |
| 78 | - $options[] = '--user=' . $this->databaseConfiguration['user']; |
|
| 78 | + $options[] = '--user='.$this->databaseConfiguration['user']; |
|
| 79 | 79 | } |
| 80 | 80 | if (isset($this->databaseConfiguration['password'])) { |
| 81 | - $options[] = '--password=' . $this->databaseConfiguration['password']; |
|
| 81 | + $options[] = '--password='.$this->databaseConfiguration['password']; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | $executor = $this->executorFactory->createForkedExecutor($instanceName, $dbConnectionSpec, NativeClient::EXECUTION_STRATEGY, false); |
| 55 | 55 | |
| 56 | - if (! $executor instanceof ShellExecutor) { |
|
| 56 | + if (!$executor instanceof ShellExecutor) { |
|
| 57 | 57 | throw new \Exception("Can not start an interactive shell for databases of type '{$dbConnectionSpec['vendor']}'"); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -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 | ); |