@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | protected function addCommonOptions() |
50 | 50 | { |
51 | 51 | $this |
52 | - ->addOption('only-instances', 'o', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Filter the database servers to run this command against. Usage of * and ? wildcards is allowed. To see all instances available, use `instance:list`', null) |
|
53 | - ->addOption('except-instances', 'x', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Filter the database servers to run this command against', null) |
|
52 | + ->addOption('only-instances', 'o', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Filter the database servers to run this command against. Usage of * and ? wildcards is allowed. To see all instances available, use `instance:list`', null) |
|
53 | + ->addOption('except-instances', 'x', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Filter the database servers to run this command against', null) |
|
54 | 54 | ->addOption('output-type', null, InputOption::VALUE_REQUIRED, 'The format for the output: json, php, text or yml', self::DEFAULT_OUTPUT_FORMAT) |
55 | 55 | ->addOption('output-file', null, InputOption::VALUE_REQUIRED, 'Save output to a file instead of writing it to stdout. NB: take care that dbconsole runs in a container, which has a different view of the filesystem. A good dir for output is ./shared') |
56 | 56 | ->addOption('timeout', null, InputOption::VALUE_REQUIRED, 'The maximum time to wait for subprocess execution (secs)', self::DEFAULT_PROCESS_TIMEOUT) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | // On Debian, which we use by default, SF has troubles understanding that php was compiled with --enable-sigchild |
78 | 78 | // We thus force it, but give end users an option to disable this |
79 | 79 | // For more details, see comment 12 at https://bugs.launchpad.net/ubuntu/+source/php5/+bug/516061 |
80 | - if (! $input->getOption('dont-force-enabled-sigchild')) { |
|
80 | + if (!$input->getOption('dont-force-enabled-sigchild')) { |
|
81 | 81 | Process::forceSigchildEnabled(true); |
82 | 82 | } |
83 | 83 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $sql = null; |
122 | 122 | } else { |
123 | 123 | // this is a coding error, not a sql execution error |
124 | - throw new \Exception("Unsupported action type: " . get_class($sqlAction)); |
|
124 | + throw new \Exception("Unsupported action type: ".get_class($sqlAction)); |
|
125 | 125 | } |
126 | 126 | $filterCallable = $sqlAction->getResultsFilterCallable(); |
127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $outputFilters[$instanceName] = $filterCallable; |
133 | 133 | |
134 | 134 | if ($filename === null && !$sqlAction->isSingleStatement()) { |
135 | - $filename = tempnam(sys_get_temp_dir(), 'db3v4l_') . '.sql'; |
|
135 | + $filename = tempnam(sys_get_temp_dir(), 'db3v4l_').'.sql'; |
|
136 | 136 | file_put_contents($filename, $sql); |
137 | 137 | $tempSQLFileNames[] = $filename; |
138 | 138 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | if ($this->outputFormat === 'text') { |
158 | - $this->writeln('Command line: ' . $process->getCommandLine(), OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
158 | + $this->writeln('Command line: '.$process->getCommandLine(), OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $process->setTimeout($this->processTimeout); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $succeeded++; |
178 | 178 | } catch (\Throwable $t) { |
179 | 179 | $failed++; |
180 | - $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: " . $t->getMessage() . "</error>\n", OutputInterface::VERBOSITY_NORMAL); |
|
180 | + $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: ".$t->getMessage()."</error>\n", OutputInterface::VERBOSITY_NORMAL); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | //$result = null; |
200 | 200 | $failed++; |
201 | 201 | $succeeded--; |
202 | - $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: " . $t->getMessage() . "</error>\n", OutputInterface::VERBOSITY_NORMAL); |
|
202 | + $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: ".$t->getMessage()."</error>\n", OutputInterface::VERBOSITY_NORMAL); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | $results[$instanceName] = $output; |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | 'exitcode' => $process->getExitCode() |
211 | 211 | ]; |
212 | 212 | $failed++; |
213 | - $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: " . $process->getErrorOutput() . "</error>\n", OutputInterface::VERBOSITY_NORMAL); |
|
213 | + $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: ".$process->getErrorOutput()."</error>\n", OutputInterface::VERBOSITY_NORMAL); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | 218 | } finally { |
219 | 219 | // make sure that we clean up temp files, as they might contain sensitive data |
220 | - foreach($tempSQLFileNames as $tempSQLFileName) { |
|
220 | + foreach ($tempSQLFileNames as $tempSQLFileName) { |
|
221 | 221 | unlink($tempSQLFileName); |
222 | 222 | } |
223 | 223 | } |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | if ($this->outputFile != null) { |
267 | 267 | file_put_contents($this->outputFile, $formattedResults); |
268 | 268 | } else { |
269 | - $this->writeln($formattedResults, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW); |
|
269 | + $this->writeln($formattedResults, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | if ($this->outputFormat === 'text' || $this->outputFile != null) { |
273 | - $this->writeln($results['succeeded'] . ' succeeded, ' . $results['failed'] . ' failed'); |
|
273 | + $this->writeln($results['succeeded'].' succeeded, '.$results['failed'].' failed'); |
|
274 | 274 | if ($this->outputFile != null) { |
275 | 275 | $this->writeln("Results saved to file {$this->outputFile}"); |
276 | 276 | } |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | $names = []; |
32 | - foreach(array_keys($this->instanceList) as $name) { |
|
32 | + foreach (array_keys($this->instanceList) as $name) { |
|
33 | 33 | |
34 | 34 | if (empty($includeFilter)) { |
35 | 35 | $include = true; |
36 | 36 | } else { |
37 | 37 | $include = false; |
38 | - foreach($includeFilter as $filter) { |
|
38 | + foreach ($includeFilter as $filter) { |
|
39 | 39 | if (fnmatch($filter, $name)) { |
40 | 40 | $include = true; |
41 | 41 | break; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | if ($include && !empty($excludeFilter)) { |
47 | - foreach($excludeFilter as $filter) { |
|
47 | + foreach ($excludeFilter as $filter) { |
|
48 | 48 | if (fnmatch($filter, $name)) { |
49 | 49 | $include = false; |
50 | 50 | break; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function getInstancesConfiguration(array $instanceNames) |
82 | 82 | { |
83 | 83 | $instancesDefinitions = []; |
84 | - foreach($instanceNames as $instanceName) |
|
84 | + foreach ($instanceNames as $instanceName) |
|
85 | 85 | { |
86 | 86 | $instancesDefinitions[$instanceName] = $this->getInstanceConfiguration($instanceName); |
87 | 87 | } |