Passed
Push — master ( 0d291e...8951fe )
by Gaetano
08:48
created
app/src/Core/DatabaseManager/SQLite.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function getListDatabasesSqlAction()
17 17
     {
18
-        $fileGlob = dirname($this->databaseConfiguration['path']) . '/*.sqlite';
18
+        $fileGlob = dirname($this->databaseConfiguration['path']).'/*.sqlite';
19 19
         return new Command(
20 20
             null,
21 21
             function() use ($fileGlob) {
22 22
                 $out = [];
23 23
                 foreach (glob($fileGlob) as $filename) {
24
-                    $out[] =  basename($filename);
24
+                    $out[] = basename($filename);
25 25
                 }
26 26
                 return $out;
27 27
             }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         /// @todo this does not support creation of the new db with a different character encoding...
47 47
         ///       see https://stackoverflow.com/questions/21348459/set-pragma-encoding-utf-16-for-main-database-in-sqlite
48
-        $filename = dirname($this->databaseConfiguration['path']) . '/' . $dbName . '.sqlite';
48
+        $filename = dirname($this->databaseConfiguration['path']).'/'.$dbName.'.sqlite';
49 49
         return new Command(
50 50
             "ATTACH '$filename' AS \"$dbName\";"
51 51
         );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function getDropDatabaseSqlAction($dbName, $userName, $ifExists = false)
63 63
     {
64
-        $filename = dirname($this->databaseConfiguration['path']) . '/' . $dbName . '.sqlite';
64
+        $filename = dirname($this->databaseConfiguration['path']).'/'.$dbName.'.sqlite';
65 65
         return new Command(
66 66
             null,
67 67
             function() use($filename, $dbName, $ifExists) {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     {
85 85
         return new Command(
86 86
             null,
87
-            function () {
87
+            function() {
88 88
                 // since sqlite does not support users, null seems more appropriate than an empty array...
89 89
                 return null;
90 90
             }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         return new Command(
117 117
             null,
118 118
             /// @todo list the supported utf16 variants as soon as allow using them
119
-            function () {
119
+            function() {
120 120
                 return [];
121 121
             }
122 122
         );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         return new Command(
144 144
             "select sqlite_version();",
145
-            function ($output, $executor) {
145
+            function($output, $executor) {
146 146
                 /** @var Executor $executor */
147 147
                 return $executor->resultSetToArray($output)[0];
148 148
             }
Please login to merge, or discard this patch.
app/src/Core/DatabaseManager/OraclePDB.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     {
22 22
         return new Command(
23 23
             "SELECT pdb_name AS Database FROM dba_pdbs ORDER BY pdb_name;",
24
-            function ($output, $executor) {
24
+            function($output, $executor) {
25 25
                 /** @var Executor $executor */
26 26
                 return $executor->resultSetToArray($output);
27 27
             }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         return new Command(
92 92
             // NB: we filter out 'system' users, as there are many...
93 93
             "SELECT username FROM cdb_users WHERE oracle_maintained != 'Y' ORDER BY username;",
94
-            function ($output, $executor) {
94
+            function($output, $executor) {
95 95
                 /** @var Executor $executor */
96 96
                 return $executor->resultSetToArray($output);
97 97
             }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         return new Command(
124 124
             "SELECT value AS Collation FROM v\$nls_valid_values WHERE parameter = 'CHARACTERSET' ORDER BY value;",
125
-            function ($output, $executor) {
125
+            function($output, $executor) {
126 126
                 /** @var Executor $executor */
127 127
                 return $executor->resultSetToArray($output);
128 128
             }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         return new Command(
139 139
             "SELECT version_full || ' (' || banner || ')' AS version FROM  v\$version, v\$instance;",
140
-            function ($output, $executor) {
140
+            function($output, $executor) {
141 141
                 /** @var Executor $executor */
142 142
                 return $executor->resultSetToArray($output)[0];
143 143
             }
Please login to merge, or discard this patch.
app/src/Core/DatabaseManager/Oracle.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         return new Command(
24 24
             "SELECT username AS Database FROM all_users WHERE oracle_maintained != 'Y' ORDER BY username;",
25
-            function ($output, $executor) {
25
+            function($output, $executor) {
26 26
                 /** @var Executor $executor */
27 27
                 return $executor->resultSetToArray($output);
28 28
             }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         return new Command(
93 93
             // NB: we filter out 'system' users, as there are many...
94 94
             "SELECT username FROM sys.all_users WHERE oracle_maintained != 'Y' ORDER BY username;",
95
-            function ($output, $executor) {
95
+            function($output, $executor) {
96 96
                 /** @var Executor $executor */
97 97
                 return $executor->resultSetToArray($output);
98 98
             }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         return new Command(
126 126
             "SELECT value AS Collation FROM v\$nls_valid_values WHERE parameter = 'CHARACTERSET' ORDER BY value;",
127
-            function ($output, $executor) {
127
+            function($output, $executor) {
128 128
                 /** @var Executor $executor */
129 129
                 return $executor->resultSetToArray($output);
130 130
             }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     {
140 140
         return new Command(
141 141
             "SELECT version_full || ' (' || banner || ')' AS version FROM  v\$version, v\$instance;",
142
-            function ($output, $executor) {
142
+            function($output, $executor) {
143 143
                 /** @var Executor $executor */
144 144
                 return $executor->resultSetToArray($output)[0];
145 145
             }
Please login to merge, or discard this patch.
app/src/Command/SQLExecutingCommand.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
     protected function addCommonOptions()
56 56
     {
57 57
         $this
58
-            ->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)
59
-            ->addOption('except-instances', 'x', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Filter the database servers to run this command against', null)
58
+            ->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)
59
+            ->addOption('except-instances', 'x', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Filter the database servers to run this command against', null)
60 60
             ->addOption('output-type', null, InputOption::VALUE_REQUIRED, 'The format for the output: json, php, text or yml', self::DEFAULT_OUTPUT_FORMAT)
61 61
             ->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')
62 62
             ->addOption('timeout', null, InputOption::VALUE_REQUIRED, 'The maximum time to wait for subprocess execution (secs)', self::DEFAULT_PROCESS_TIMEOUT)
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         // On Debian, which we use by default, SF has troubles understanding that php was compiled with --enable-sigchild
84 84
         // We thus force it, but give end users an option to disable this
85 85
         // For more details, see comment 12 at https://bugs.launchpad.net/ubuntu/+source/php5/+bug/516061
86
-        if (! $input->getOption('dont-force-enabled-sigchild')) {
86
+        if (!$input->getOption('dont-force-enabled-sigchild')) {
87 87
             Process::forceSigchildEnabled(true);
88 88
         }
89 89
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                     $sql = null;
128 128
                 } else {
129 129
                     // this is a coding error, not a sql execution error
130
-                    throw new \Exception("Unsupported action type: " . get_class($sqlAction));
130
+                    throw new \Exception("Unsupported action type: ".get_class($sqlAction));
131 131
                 }
132 132
                 $filterCallable = $sqlAction->getResultsFilterCallable();
133 133
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                     $outputFilters[$instanceName] = $filterCallable;
139 139
 
140 140
                     if ($filename === null && !$sqlAction->isSingleStatement()) {
141
-                        $filename = tempnam(sys_get_temp_dir(), 'db3v4l_') . '.sql';
141
+                        $filename = tempnam(sys_get_temp_dir(), 'db3v4l_').'.sql';
142 142
                         file_put_contents($filename, $sql);
143 143
                         $tempSQLFileNames[] = $filename;
144 144
                     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                         }
162 162
 
163 163
                         if ($this->outputFormat === 'text') {
164
-                            $this->writeln('Command line: ' . $process->getCommandLine(), OutputInterface::VERBOSITY_VERY_VERBOSE);
164
+                            $this->writeln('Command line: '.$process->getCommandLine(), OutputInterface::VERBOSITY_VERY_VERBOSE);
165 165
                         }
166 166
 
167 167
                         $process->setTimeout($this->processTimeout);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                         'stderr' => $t->getMessage(),
188 188
                     ];
189 189
                     $failed++;
190
-                    $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: " . $t->getMessage() . "</error>\n", OutputInterface::VERBOSITY_NORMAL);
190
+                    $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: ".$t->getMessage()."</error>\n", OutputInterface::VERBOSITY_NORMAL);
191 191
                 }
192 192
             }
193 193
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                                 ];
213 213
                                 $failed++;
214 214
                                 $succeeded--;
215
-                                $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: " . $t->getMessage() . "</error>\n", OutputInterface::VERBOSITY_NORMAL);
215
+                                $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: ".$t->getMessage()."</error>\n", OutputInterface::VERBOSITY_NORMAL);
216 216
                             }
217 217
                         }
218 218
                         $results[$instanceName] = $output;
@@ -229,19 +229,19 @@  discard block
 block discarded – undo
229 229
                         ];
230 230
 
231 231
                         $failed++;
232
-                        $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: " . $err . "</error>\n", OutputInterface::VERBOSITY_NORMAL);
232
+                        $this->writeErrorln("\n<error>$actionName in instance '$instanceName' failed! Reason: ".$err."</error>\n", OutputInterface::VERBOSITY_NORMAL);
233 233
                     }
234 234
                 }
235 235
             }
236 236
 
237 237
         } finally {
238 238
             // make sure that we clean up temp files, as they might contain sensitive data
239
-            foreach($tempSQLFileNames as $tempSQLFileName) {
239
+            foreach ($tempSQLFileNames as $tempSQLFileName) {
240 240
                 unlink($tempSQLFileName);
241 241
             }
242 242
         }
243 243
 
244
-        uksort($results, function ($a, $b) {
244
+        uksort($results, function($a, $b) {
245 245
             $aParts = explode('_', $a, 2);
246 246
             $bParts = explode('_', $b, 2);
247 247
             $cmp = strcasecmp($aParts[0], $bParts[0]);
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
             $this->writeResultsToFile($results);
301 301
         } else {
302 302
             $formattedResults = $this->formatResults($results);
303
-            $this->writeln($formattedResults, OutputInterface::VERBOSITY_QUIET,  OutputInterface::OUTPUT_RAW);
303
+            $this->writeln($formattedResults, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW);
304 304
         }
305 305
 
306 306
         if ($this->outputFormat === 'text' || $this->outputFile != null) {
307
-            $this->writeln($results['succeeded'] . ' succeeded, ' . $results['failed'] . ' failed');
307
+            $this->writeln($results['succeeded'].' succeeded, '.$results['failed'].' failed');
308 308
             if ($this->outputFile != null) {
309 309
                 $this->writeln("Results saved to file {$this->outputFile}");
310 310
             }
Please login to merge, or discard this patch.
app/src/Command/DatabaseManagingCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $results = $this->executeSqlAction(
23 23
             $instanceList,
24 24
             'Creating new database & user',
25
-            function ($schemaManager, $instanceName) use ($dbSpecList) {
25
+            function($schemaManager, $instanceName) use ($dbSpecList) {
26 26
                 $dbConnectionSpec = $dbSpecList[$instanceName];
27 27
                 /** @var DatabaseSchemaManager $schemaManager */
28 28
                 return $schemaManager->getCreateDatabaseSqlAction(
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         ///       f.e. connection specs for Oracle to be different when using PDBs vs when using schemas
39 39
         ///       (this could be achieved by copying the 'dbname' member over the 'servicename' one, or unsetting 'servicename'...)
40 40
         $finalData = [];
41
-        foreach($results['data'] as $instanceName => $data) {
41
+        foreach ($results['data'] as $instanceName => $data) {
42 42
             // check for failure in creation of temp db
43 43
             // @todo how can we tell apart correctly errors that actually prevented the db from being created from other errors?
44 44
             if (is_array($data) && isset($data['exitcode']) && $data['exitcode'] != 0) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         return $this->executeSqlAction(
76 76
             $instanceList,
77 77
             'Dropping of database & user',
78
-            function ($schemaManager, $instanceName) use ($dbSpecList, $ifExists) {
78
+            function($schemaManager, $instanceName) use ($dbSpecList, $ifExists) {
79 79
                 $dbConnectionSpec = $dbSpecList[$instanceName];
80 80
                 /** @var DatabaseSchemaManager $schemaManager */
81 81
                 return $schemaManager->getDropDatabaseSqlAction(
Please login to merge, or discard this patch.
app/src/Command/SqlExecute.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
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(15)); // some oracle versions have a limit of 30 chars on passwords
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
 block discarded – undo
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
 block discarded – undo
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
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             if ($createDB) {
145 145
                 $results['failed'] += $creationResults['failed'];
146 146
 
147
-                foreach($instanceList as $instanceName  => $instanceSpecs) {
147
+                foreach ($instanceList as $instanceName  => $instanceSpecs) {
148 148
                     if (!isset($dbConnectionSpecs[$instanceName])) {
149 149
                         /// @todo retrieve the actual temp db creation error instead of doing this...
150 150
                         $results['data'][$instanceName] = [
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
                 $this->executionStrategy = $previousStrategy;
162 162
             }
163 163
         } else {
164
-            $results = ['succeeded' => 0,  'failed' => 0, 'data' => null];
164
+            $results = ['succeeded' => 0, 'failed' => 0, 'data' => null];
165 165
         }
166 166
 
167 167
         $time = microtime(true) - $start;
168 168
 
169 169
         $this->writeResults($results, $time);
170 170
 
171
-        return (int)$results['failed'];
171
+        return (int) $results['failed'];
172 172
     }
173 173
 
174 174
     /**
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
         return $this->executeSqlAction(
187 187
             $dbConnectionSpecs,
188 188
             'Execution of SQL',
189
-            function ($schemaManager, $instanceName) use ($sql, $filename) {
189
+            function($schemaManager, $instanceName) use ($sql, $filename) {
190 190
                 if ($sql != null) {
191 191
                     return new Command(
192 192
                         $sql,
193
-                        function ($output, $executor) {
193
+                        function($output, $executor) {
194 194
                             /** @var TimedExecutor $executor */
195 195
                             return array_merge(['stdout' => $output], $executor->getTimingData());
196 196
                         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                     }
204 204
                     return new File(
205 205
                         $realFileName,
206
-                        function ($output, $executor) {
206
+                        function($output, $executor) {
207 207
                             /** @var TimedExecutor $executor */
208 208
                             return array_merge(['stdout' => $output], $executor->getTimingData());
209 209
                         }
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
             if (trim($line) !== '') {
239 239
                 if ($type === 'err') {
240 240
                     $this->writeErrorln(
241
-                        '[' . $processIndex . '][' . $pid . '] ' . trim($line),
241
+                        '['.$processIndex.']['.$pid.'] '.trim($line),
242 242
                         OutputInterface::VERBOSITY_VERBOSE,
243 243
                         OutputInterface::OUTPUT_RAW
244 244
                     );
245 245
                 } else {
246 246
                     $this->writeln(
247
-                        '[' . $processIndex . '][' . $pid . '] ' . trim($line),
247
+                        '['.$processIndex.']['.$pid.'] '.trim($line),
248 248
                         OutputInterface::VERBOSITY_VERBOSE,
249 249
                         OutputInterface::OUTPUT_RAW
250 250
                     );
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             return;
288 288
         }
289 289
 
290
-        foreach($results['data'] as $instanceName => $data) {
290
+        foreach ($results['data'] as $instanceName => $data) {
291 291
             $formattedData = $this->formatResults(array('data' => $data));
292 292
             $outputFile = $this->replaceDBSpecTokens($this->outputFile, $instanceName, $this->dbConfigurationManager->getInstanceConfiguration($instanceName));
293 293
             file_put_contents($outputFile, $formattedData);
Please login to merge, or discard this patch.
adminer/public/index.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@  discard block
 block discarded – undo
6 6
 {
7 7
     // Avoid bootstrapping Symfony for something so trivial...
8 8
 
9
-    $configDir = dirname(dirname(__DIR__)) . '/vendors';
9
+    $configDir = dirname(dirname(__DIR__)).'/vendors';
10 10
 
11
-    include_once($configDir . '/secrets.php');
11
+    include_once($configDir.'/secrets.php');
12 12
 
13
-    $files = glob($configDir . '/*.yml');
14
-    foreach($files as $fileName) {
13
+    $files = glob($configDir.'/*.yml');
14
+    foreach ($files as $fileName) {
15 15
         $vendorConfig = \Symfony\Component\Yaml\Yaml::parseFile($fileName);
16 16
         if (isset($vendorConfig['db3v4l']['database_instances'])) {
17 17
             foreach ($vendorConfig['db3v4l']['database_instances'] as $name => &$instanceConfig) {
@@ -28,12 +28,11 @@  discard block
 block discarded – undo
28 28
     ksort($config);
29 29
 
30 30
     $servers = [];
31
-    foreach($config as $instance => $def) {
31
+    foreach ($config as $instance => $def) {
32 32
         $servers[$instance] = new AdminerLoginServerEnhanced(
33 33
             (
34 34
                 $def['vendor'] == 'oracle' ?
35
-                ('//'.$def['host'].':'.$def['port'].'/'.$def['servicename']) :
36
-                ($def['host'].':'.$def['port'])
35
+                ('//'.$def['host'].':'.$def['port'].'/'.$def['servicename']) : ($def['host'].':'.$def['port'])
37 36
             ),
38 37
             $def['vendor'].' '.$def['version'],
39 38
             str_replace(
Please login to merge, or discard this patch.
adminer/adminer/plugins/login-servers-enhanced.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
         }
90 90
         $html .= '</select>';
91 91
 
92
-        $html .= '<script type="text/javascript" ' . nonce() . '>';
92
+        $html .= '<script type="text/javascript" '.nonce().'>';
93 93
         $html .= 'function switchServer() { ';
94 94
         $html .= 'var selectServer = document.getElementsByName("auth[server]")[0]; ';
95 95
         $html .= 'var driver = selectServer.options[selectServer.selectedIndex].getAttribute("driver"); ';
Please login to merge, or discard this patch.