@@ -7,7 +7,7 @@ |
||
7 | 7 | // Avoid bootstrapping Symfony for something so trivial... |
8 | 8 | $config = \Symfony\Component\Yaml\Yaml::parseFile(dirname(dirname(__DIR__)).'/config/services.yaml'); |
9 | 9 | $servers = []; |
10 | - foreach($config['parameters']['db3v4l.database_instances'] as $instance => $def) { |
|
10 | + foreach ($config['parameters']['db3v4l.database_instances'] as $instance => $def) { |
|
11 | 11 | $servers[$instance] = new AdminerLoginServerEnhanced( |
12 | 12 | $def['host'].':'.$def['port'], |
13 | 13 | $def['vendor'].' '.$def['version'], |
@@ -9,6 +9,6 @@ |
||
9 | 9 | public function buildCommandLine($command, array $arguments = array()) |
10 | 10 | { |
11 | 11 | $arguments = array_map('escapeshellarg', $arguments); |
12 | - return escapeshellcmd($command) . ' ' . implode(' ', $arguments); |
|
12 | + return escapeshellcmd($command).' '.implode(' ', $arguments); |
|
13 | 13 | } |
14 | 14 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | case 'mysql': |
56 | 56 | $command = 'mysql'; |
57 | 57 | $options = [ |
58 | - '--host=' . $this->databaseConfiguration['host'], |
|
59 | - '--port=' . $this->databaseConfiguration['port'] ?? '3306', |
|
60 | - '--user=' . $this->databaseConfiguration['user'], |
|
61 | - '-p' . $this->databaseConfiguration['password'], |
|
58 | + '--host='.$this->databaseConfiguration['host'], |
|
59 | + '--port='.$this->databaseConfiguration['port'] ?? '3306', |
|
60 | + '--user='.$this->databaseConfiguration['user'], |
|
61 | + '-p'.$this->databaseConfiguration['password'], |
|
62 | 62 | '--binary-mode', // 'It also disables all mysql commands except charset and delimiter in non-interactive mode (for input piped to mysql or loaded using the source command)' |
63 | 63 | '-t', |
64 | 64 | ]; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $options[] = $this->databaseConfiguration['dbname']; |
67 | 67 | } |
68 | 68 | if ($action == self::EXECUTE_COMMAND) { |
69 | - $options[] = '--execute=' . $sqlOrFilename; |
|
69 | + $options[] = '--execute='.$sqlOrFilename; |
|
70 | 70 | } |
71 | 71 | // $env = [ |
72 | 72 | // problematic when wrapping the process in a call to `time`... |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | // NB: this triggers a different behaviour that piping multiple commands to stdin, namely |
89 | 89 | // it wraps all of the commands in a transaction and allows either sql commands or a single meta-command |
90 | 90 | if ($action == self::EXECUTE_COMMAND) { |
91 | - $options[] = '--command=' . $sqlOrFilename; |
|
91 | + $options[] = '--command='.$sqlOrFilename; |
|
92 | 92 | } |
93 | 93 | //$env = [ |
94 | 94 | // problematic when wrapping the process in a call to `time`... |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | case 'sqlcmd': |
100 | 100 | $command = 'sqlcmd'; |
101 | 101 | $options = [ |
102 | - '-S' . $this->databaseConfiguration['host'] . ($this->databaseConfiguration['port'] != '' ? ',' . $this->databaseConfiguration['port'] : ''), |
|
103 | - '-U' . $this->databaseConfiguration['user'], |
|
104 | - '-P' . $this->databaseConfiguration['password'], |
|
102 | + '-S'.$this->databaseConfiguration['host'].($this->databaseConfiguration['port'] != '' ? ','.$this->databaseConfiguration['port'] : ''), |
|
103 | + '-U'.$this->databaseConfiguration['user'], |
|
104 | + '-P'.$this->databaseConfiguration['password'], |
|
105 | 105 | '-r1', |
106 | 106 | '-b', |
107 | 107 | ]; |
108 | 108 | if (isset($this->databaseConfiguration['dbname'])) { |
109 | - $options[] = '-d' . $this->databaseConfiguration['dbname']; |
|
109 | + $options[] = '-d'.$this->databaseConfiguration['dbname']; |
|
110 | 110 | } |
111 | 111 | if ($action == self::EXECUTE_FILE) { |
112 | - $options[] = '-i' . $sqlOrFilename; |
|
112 | + $options[] = '-i'.$sqlOrFilename; |
|
113 | 113 | } elseif ($action == self::EXECUTE_COMMAND) { |
114 | - $options[] = '-Q' . $sqlOrFilename; |
|
114 | + $options[] = '-Q'.$sqlOrFilename; |
|
115 | 115 | } |
116 | 116 | break; |
117 | 117 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | // 'path' is the full path to the 'master' db (for Doctrine compatibility). |
121 | 121 | // non-master dbs are supposed to reside in the same directory |
122 | 122 | if (isset($this->databaseConfiguration['dbname'])) { |
123 | - $options[] = dirname($this->databaseConfiguration['path']) . '/' . $this->databaseConfiguration['dbname'] . '.sqlite'; |
|
123 | + $options[] = dirname($this->databaseConfiguration['path']).'/'.$this->databaseConfiguration['dbname'].'.sqlite'; |
|
124 | 124 | } else { |
125 | 125 | $options[] = $this->databaseConfiguration['path']; |
126 | 126 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | /// @todo investigate: for psql is this better done via --file ? |
145 | 145 | if ($action == self::EXECUTE_FILE && $clientType != 'sqlsrv') { |
146 | - $commandLine .= ' < ' . escapeshellarg($sqlOrFilename); |
|
146 | + $commandLine .= ' < '.escapeshellarg($sqlOrFilename); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return new Process($commandLine, null, $env); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | array_shift($output); // headers |
182 | 182 | array_shift($output); // '+--+' |
183 | 183 | array_pop($output); // '+--+' |
184 | - foreach($output as &$line) { |
|
184 | + foreach ($output as &$line) { |
|
185 | 185 | $line = trim($line, '|'); |
186 | 186 | $line = trim($line); |
187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | array_shift($output); // headers |
193 | 193 | array_shift($output); // '---' |
194 | 194 | //array_pop($output); // '(N rows)' |
195 | - foreach($output as &$line) { |
|
195 | + foreach ($output as &$line) { |
|
196 | 196 | $line = trim($line); |
197 | 197 | } |
198 | 198 | return $output; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | array_shift($output); // '---' |
206 | 206 | array_pop($output); // blank line |
207 | 207 | array_pop($output); // '(N rows affected)' |
208 | - foreach($output as &$line) { |
|
208 | + foreach ($output as &$line) { |
|
209 | 209 | $line = trim($line); |
210 | 210 | } |
211 | 211 | return $output; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | // wrap in a `time` call |
30 | 30 | $this->timingFile = tempnam(sys_get_temp_dir(), 'db3v4l_'); |
31 | 31 | $process->setCommandLine( |
32 | - $this->timeCmd . ' ' . escapeshellarg('--output=' . $this->timingFile) . ' ' . escapeshellarg('--format=%M %e') . ' ' |
|
32 | + $this->timeCmd.' '.escapeshellarg('--output='.$this->timingFile).' '.escapeshellarg('--format=%M %e').' ' |
|
33 | 33 | . $process->getCommandLine()); |
34 | 34 | return $process; |
35 | 35 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | // wrap in a `time` call |
42 | 42 | $this->timingFile = tempnam(sys_get_temp_dir(), 'db3v4l_'); |
43 | 43 | $process->setCommandLine( |
44 | - $this->timeCmd . ' ' . escapeshellarg('--output=' . $this->timingFile) . ' ' . escapeshellarg('--format=%M %e') . ' ' |
|
44 | + $this->timeCmd.' '.escapeshellarg('--output='.$this->timingFile).' '.escapeshellarg('--format=%M %e').' ' |
|
45 | 45 | . $process->getCommandLine()); |
46 | 46 | |
47 | 47 | return $process; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if ($onceIsEnough) { |
73 | - unlink ($this->timingFile); |
|
73 | + unlink($this->timingFile); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $results; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $currentProcesses = array_splice($processesQueue, 0, $maxParallel); |
29 | 29 | // start the initial stack of processes |
30 | 30 | foreach ($currentProcesses as $idx => $process) { |
31 | - $process->start(function ($type, $buffer) use ($callback, $idx, $process) { |
|
31 | + $process->start(function($type, $buffer) use ($callback, $idx, $process) { |
|
32 | 32 | if ($callback) { |
33 | 33 | $callback($type, $buffer, $idx, $process); |
34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // directly add and start new process after the previous finished |
45 | 45 | if (count($processesQueue) > 0) { |
46 | 46 | $nextProcess = array_shift($processesQueue); |
47 | - $nextProcess->start(function ($type, $buffer) use ($callback, $nextProcess) { |
|
47 | + $nextProcess->start(function($type, $buffer) use ($callback, $nextProcess) { |
|
48 | 48 | if ($callback) { |
49 | 49 | $callback($type, $buffer, $nextProcess); |
50 | 50 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function list() |
20 | 20 | { |
21 | - $docs = glob($this->docRoot . '/*.md'); |
|
22 | - array_walk($docs, function(&$path, $key) {$path = basename($path);}); |
|
21 | + $docs = glob($this->docRoot.'/*.md'); |
|
22 | + array_walk($docs, function(&$path, $key) {$path = basename($path); }); |
|
23 | 23 | return $this->render('Doc/list.html.twig', ['docs' => $docs]); |
24 | 24 | } |
25 | 25 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | // sanitize |
35 | 35 | $filename = basename($filename); |
36 | 36 | |
37 | - $filename = $this->docRoot . '/' . $filename; |
|
37 | + $filename = $this->docRoot.'/'.$filename; |
|
38 | 38 | |
39 | 39 | if (!is_file($filename)) { |
40 | 40 | throw $this->createNotFoundException("The doc file '$filename' does not exist"); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function list(DatabaseConfigurationManager $configurationManager) |
18 | 18 | { |
19 | 19 | $instances = []; |
20 | - foreach($configurationManager->listInstances() as $instanceName) { |
|
20 | + foreach ($configurationManager->listInstances() as $instanceName) { |
|
21 | 21 | $instances[$instanceName] = $configurationManager->getInstanceConfiguration($instanceName); |
22 | 22 | } |
23 | 23 | return $this->render('Instance/list.html.twig', ['instances' => $instances]); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | $dbToDropSpecs = []; |
59 | - foreach($instanceList as $instanceName => $instanceSpecs) { |
|
59 | + foreach ($instanceList as $instanceName => $instanceSpecs) { |
|
60 | 60 | $dbToDropSpecs[$instanceName] = [ |
61 | 61 | 'dbname' => $dbName |
62 | 62 | ]; |
@@ -74,6 +74,6 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->writeResults($results, $time); |
76 | 76 | |
77 | - return (int)$results['failed']; |
|
77 | + return (int) $results['failed']; |
|
78 | 78 | } |
79 | 79 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | $newDbSpecs = []; |
77 | - foreach($instanceList as $instanceName => $instanceSpecs) { |
|
77 | + foreach ($instanceList as $instanceName => $instanceSpecs) { |
|
78 | 78 | $newDbSpecs[$instanceName] = [ |
79 | 79 | 'dbname' => $dbName |
80 | 80 | ]; |
@@ -93,6 +93,6 @@ discard block |
||
93 | 93 | |
94 | 94 | $this->writeResults($results, $time); |
95 | 95 | |
96 | - return (int)$results['failed']; |
|
96 | + return (int) $results['failed']; |
|
97 | 97 | } |
98 | 98 | } |