@@ -7,12 +7,11 @@ |
||
| 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 | ( |
| 13 | 13 | $def['vendor'] == 'oracle' ? |
| 14 | - ('//'.$def['host'].':'.$def['port'].'/'.$def['servicename']) : |
|
| 15 | - ($def['host'].':'.$def['port']) |
|
| 14 | + ('//'.$def['host'].':'.$def['port'].'/'.$def['servicename']) : ($def['host'].':'.$def['port']) |
|
| 16 | 15 | ), |
| 17 | 16 | $def['vendor'].' '.$def['version'], |
| 18 | 17 | str_replace( |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | case 'mysql': |
| 55 | 55 | $command = 'mysql'; |
| 56 | 56 | $options = [ |
| 57 | - '--host=' . $this->databaseConfiguration['host'], |
|
| 58 | - '--port=' . $this->databaseConfiguration['port'] ?? '3306', |
|
| 59 | - '--user=' . $this->databaseConfiguration['user'], |
|
| 60 | - '-p' . $this->databaseConfiguration['password'], |
|
| 57 | + '--host='.$this->databaseConfiguration['host'], |
|
| 58 | + '--port='.$this->databaseConfiguration['port'] ?? '3306', |
|
| 59 | + '--user='.$this->databaseConfiguration['user'], |
|
| 60 | + '-p'.$this->databaseConfiguration['password'], |
|
| 61 | 61 | '--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)' |
| 62 | 62 | '-t', |
| 63 | 63 | ]; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $options[] = $this->databaseConfiguration['dbname']; |
| 66 | 66 | } |
| 67 | 67 | if ($action == self::EXECUTE_COMMAND) { |
| 68 | - $options[] = '--execute=' . $sqlOrFilename; |
|
| 68 | + $options[] = '--execute='.$sqlOrFilename; |
|
| 69 | 69 | } |
| 70 | 70 | // $env = [ |
| 71 | 71 | // problematic when wrapping the process in a call to `time`... |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | // NB: this triggers a different behaviour that piping multiple commands to stdin, namely |
| 88 | 88 | // it wraps all of the commands in a transaction and allows either sql commands or a single meta-command |
| 89 | 89 | if ($action == self::EXECUTE_COMMAND) { |
| 90 | - $options[] = '--command=' . $sqlOrFilename; |
|
| 90 | + $options[] = '--command='.$sqlOrFilename; |
|
| 91 | 91 | } |
| 92 | 92 | //$env = [ |
| 93 | 93 | // problematic when wrapping the process in a call to `time`... |
@@ -98,19 +98,19 @@ discard block |
||
| 98 | 98 | case 'sqlcmd': |
| 99 | 99 | $command = 'sqlcmd'; |
| 100 | 100 | $options = [ |
| 101 | - '-S' . $this->databaseConfiguration['host'] . ($this->databaseConfiguration['port'] != '' ? ',' . $this->databaseConfiguration['port'] : ''), |
|
| 102 | - '-U' . $this->databaseConfiguration['user'], |
|
| 103 | - '-P' . $this->databaseConfiguration['password'], |
|
| 101 | + '-S'.$this->databaseConfiguration['host'].($this->databaseConfiguration['port'] != '' ? ','.$this->databaseConfiguration['port'] : ''), |
|
| 102 | + '-U'.$this->databaseConfiguration['user'], |
|
| 103 | + '-P'.$this->databaseConfiguration['password'], |
|
| 104 | 104 | '-r1', |
| 105 | 105 | '-b', |
| 106 | 106 | ]; |
| 107 | 107 | if (isset($this->databaseConfiguration['dbname'])) { |
| 108 | - $options[] = '-d' . $this->databaseConfiguration['dbname']; |
|
| 108 | + $options[] = '-d'.$this->databaseConfiguration['dbname']; |
|
| 109 | 109 | } |
| 110 | 110 | if ($action == self::EXECUTE_FILE) { |
| 111 | - $options[] = '-i' . $sqlOrFilename; |
|
| 111 | + $options[] = '-i'.$sqlOrFilename; |
|
| 112 | 112 | } elseif ($action == self::EXECUTE_COMMAND) { |
| 113 | - $options[] = '-Q' . $sqlOrFilename; |
|
| 113 | + $options[] = '-Q'.$sqlOrFilename; |
|
| 114 | 114 | } |
| 115 | 115 | break; |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | // 'path' is the full path to the 'master' db (for Doctrine compatibility). |
| 120 | 120 | // non-master dbs are supposed to reside in the same directory |
| 121 | 121 | if (isset($this->databaseConfiguration['dbname'])) { |
| 122 | - $options[] = dirname($this->databaseConfiguration['path']) . '/' . $this->databaseConfiguration['dbname'] . '.sqlite'; |
|
| 122 | + $options[] = dirname($this->databaseConfiguration['path']).'/'.$this->databaseConfiguration['dbname'].'.sqlite'; |
|
| 123 | 123 | } else { |
| 124 | 124 | $options[] = $this->databaseConfiguration['path']; |
| 125 | 125 | } |
@@ -133,22 +133,22 @@ discard block |
||
| 133 | 133 | /// @todo disable execution of dangerous (or all) SQLPLUS commands. |
| 134 | 134 | /// See the list at https://docs.oracle.com/en/database/oracle/oracle-database/18/sqpug/SQL-Plus-command-reference.html#GUID-177F24B7-D154-4F8B-A05B-7568079800C6 |
| 135 | 135 | $command = 'sqlplus'; |
| 136 | - $connectionIdentifier = '//' . $this->databaseConfiguration['host'] . |
|
| 137 | - ($this->databaseConfiguration['port'] != '' ? ':' . $this->databaseConfiguration['port'] : ''); |
|
| 136 | + $connectionIdentifier = '//'.$this->databaseConfiguration['host']. |
|
| 137 | + ($this->databaseConfiguration['port'] != '' ? ':'.$this->databaseConfiguration['port'] : ''); |
|
| 138 | 138 | // nb: for oracle, if we use pdbs to map 'databases', they get a new service name |
| 139 | 139 | /// @todo allow support for _not_ doing that, and using schemas as 'databases' |
| 140 | 140 | if (isset($this->databaseConfiguration['servicename'])) { |
| 141 | - $connectionIdentifier .= '/' . $this->databaseConfiguration['servicename']; |
|
| 141 | + $connectionIdentifier .= '/'.$this->databaseConfiguration['servicename']; |
|
| 142 | 142 | } else { |
| 143 | 143 | if ($this->databaseConfiguration['dbname'] != '') { |
| 144 | - $connectionIdentifier .= '/' . $this->databaseConfiguration['dbname']; |
|
| 144 | + $connectionIdentifier .= '/'.$this->databaseConfiguration['dbname']; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | $options = [ |
| 148 | 148 | '-L', // 'attempts to log in just once, instead of reprompting on error' |
| 149 | 149 | '-NOLOGINTIME', |
| 150 | 150 | '-S', |
| 151 | - $this->databaseConfiguration['user'] . '/' . $this->databaseConfiguration['password'] . '@' . $connectionIdentifier, |
|
| 151 | + $this->databaseConfiguration['user'].'/'.$this->databaseConfiguration['password'].'@'.$connectionIdentifier, |
|
| 152 | 152 | ]; |
| 153 | 153 | /// @todo make this optional somehow / allow SYSOPER as alternative |
| 154 | 154 | if (strtolower($this->databaseConfiguration['user']) === 'sys') { |
@@ -158,10 +158,10 @@ discard block |
||
| 158 | 158 | if ($action == self::EXECUTE_FILE) { |
| 159 | 159 | /// @todo wouldn't it be better to create another temp file with prefixed the sqlplus commands? |
| 160 | 160 | //$options[] = '@' . $sqlOrFilename; |
| 161 | - $sqlOrFilename = "WHENEVER OSERROR EXIT FAILURE;\nWHENEVER SQLERROR EXIT SQL.SQLCODE;\nSET PAGESIZE 50000;\nSET FEEDBACK OFF;\n" . file_get_contents($sqlOrFilename); |
|
| 161 | + $sqlOrFilename = "WHENEVER OSERROR EXIT FAILURE;\nWHENEVER SQLERROR EXIT SQL.SQLCODE;\nSET PAGESIZE 50000;\nSET FEEDBACK OFF;\n".file_get_contents($sqlOrFilename); |
|
| 162 | 162 | $action = self::EXECUTE_COMMAND; |
| 163 | 163 | } else { |
| 164 | - $sqlOrFilename = "WHENEVER OSERROR EXIT FAILURE;\nWHENEVER SQLERROR EXIT SQL.SQLCODE;\nSET PAGESIZE 50000;\nSET FEEDBACK OFF;\n" . $sqlOrFilename; |
|
| 164 | + $sqlOrFilename = "WHENEVER OSERROR EXIT FAILURE;\nWHENEVER SQLERROR EXIT SQL.SQLCODE;\nSET PAGESIZE 50000;\nSET FEEDBACK OFF;\n".$sqlOrFilename; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | break; |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | /// @todo investigate: for psql is this better done via --file ? |
| 176 | 176 | if ($action == self::EXECUTE_FILE && $clientType != 'sqlsrv' && $clientType != 'sqlplus') { |
| 177 | - $commandLine .= ' < ' . escapeshellarg($sqlOrFilename); |
|
| 177 | + $commandLine .= ' < '.escapeshellarg($sqlOrFilename); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if ($action == self::EXECUTE_COMMAND && $clientType == 'sqlplus') { |
| 181 | - $commandLine .= " << 'SQLEOF'\n" . $sqlOrFilename . "\nSQLEOF"; |
|
| 181 | + $commandLine .= " << 'SQLEOF'\n".$sqlOrFilename."\nSQLEOF"; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $process = Process::fromShellCommandline($commandLine, null, $env); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | array_shift($output); // headers |
| 226 | 226 | array_shift($output); // '+--+' |
| 227 | 227 | array_pop($output); // '+--+' |
| 228 | - foreach($output as &$line) { |
|
| 228 | + foreach ($output as &$line) { |
|
| 229 | 229 | $line = trim($line, '|'); |
| 230 | 230 | $line = trim($line); |
| 231 | 231 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | array_shift($output); // empty line |
| 236 | 236 | array_shift($output); // headers |
| 237 | 237 | array_shift($output); // '---' |
| 238 | - foreach($output as &$line) { |
|
| 238 | + foreach ($output as &$line) { |
|
| 239 | 239 | $line = trim($line); |
| 240 | 240 | } |
| 241 | 241 | return $output; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | array_shift($output); // headers |
| 245 | 245 | array_shift($output); // '---' |
| 246 | 246 | //array_pop($output); // '(N rows)' |
| 247 | - foreach($output as &$line) { |
|
| 247 | + foreach ($output as &$line) { |
|
| 248 | 248 | $line = trim($line); |
| 249 | 249 | } |
| 250 | 250 | return $output; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | array_shift($output); // '---' |
| 258 | 258 | array_pop($output); // blank line |
| 259 | 259 | array_pop($output); // '(N rows affected)' |
| 260 | - foreach($output as &$line) { |
|
| 260 | + foreach ($output as &$line) { |
|
| 261 | 261 | $line = trim($line); |
| 262 | 262 | } |
| 263 | 263 | return $output; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | return new Command( |
| 19 | 19 | 'SELECT datname AS "Database" FROM pg_database ORDER BY datname;', |
| 20 | - function ($output, $executor) { |
|
| 20 | + function($output, $executor) { |
|
| 21 | 21 | /** @var Executor $executor */ |
| 22 | 22 | return $executor->resultSetToArray($output); |
| 23 | 23 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | $statements = [ |
| 41 | 41 | // q: do we need to add 'TEMPLATE template0' ? |
| 42 | 42 | // see f.e. https://www.vertabelo.com/blog/collations-in-postgresql/ |
| 43 | - "CREATE DATABASE \"$dbName\"" . ($collation !== null ? " ENCODING $collation" : '') . ';', |
|
| 43 | + "CREATE DATABASE \"$dbName\"".($collation !== null ? " ENCODING $collation" : '').';', |
|
| 44 | 44 | ]; |
| 45 | 45 | if ($userName != '') { |
| 46 | 46 | $statements[] = "COMMIT;"; |
| 47 | - $statements[] = "CREATE USER \"$userName\" WITH PASSWORD '$password'" . ';'; |
|
| 47 | + $statements[] = "CREATE USER \"$userName\" WITH PASSWORD '$password'".';'; |
|
| 48 | 48 | $statements[] = "GRANT ALL ON DATABASE \"$dbName\" TO \"$userName\""; // q: should we avoid granting CREATE? |
| 49 | 49 | } |
| 50 | 50 | return new Command($statements); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | return new Command( |
| 84 | 84 | 'SELECT usename AS "User" FROM pg_catalog.pg_user ORDER BY usename;', |
| 85 | - function ($output, $executor) { |
|
| 85 | + function($output, $executor) { |
|
| 86 | 86 | /** @var Executor $executor */ |
| 87 | 87 | return $executor->resultSetToArray($output); |
| 88 | 88 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | return new Command( |
| 117 | 117 | 'SELECT collname AS Collation FROM pg_collation ORDER BY collname', |
| 118 | - function ($output, $executor) { |
|
| 118 | + function($output, $executor) { |
|
| 119 | 119 | /** @var Executor $executor */ |
| 120 | 120 | return $executor->resultSetToArray($output); |
| 121 | 121 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | return new Command( |
| 132 | 132 | 'SHOW server_version;', |
| 133 | - function ($output, $executor) { |
|
| 133 | + function($output, $executor) { |
|
| 134 | 134 | /** @var Executor $executor */ |
| 135 | 135 | return $executor->resultSetToArray($output)[0]; |
| 136 | 136 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | // the way we create it, the user account is contained in the db |
| 20 | 20 | // @todo add "WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')" ? |
| 21 | 21 | "SELECT name AS 'Database' FROM sys.databases ORDER BY name;", |
| 22 | - function ($output, $executor) { |
|
| 22 | + function($output, $executor) { |
|
| 23 | 23 | /** @var Executor $executor */ |
| 24 | 24 | return $executor->resultSetToArray($output); |
| 25 | 25 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // Also, by default connections are in autocommit mode... |
| 46 | 46 | // And yet, we need a GO to commit the db creation... |
| 47 | 47 | "SET QUOTED_IDENTIFIER ON;", |
| 48 | - "CREATE DATABASE \"$dbName\"" . ($collation !== null ? " COLLATE $collation" : '') . ';' |
|
| 48 | + "CREATE DATABASE \"$dbName\"".($collation !== null ? " COLLATE $collation" : '').';' |
|
| 49 | 49 | ]; |
| 50 | 50 | if ($userName != '') { |
| 51 | 51 | $statements[] = "CREATE LOGIN \"$userName\" WITH PASSWORD = '$password', DEFAULT_DATABASE = \"$dbName\", CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF;"; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | return new Command( |
| 97 | 97 | "SELECT name AS 'User' FROM sys.sql_logins ORDER BY name", |
| 98 | - function ($output, $executor) { |
|
| 98 | + function($output, $executor) { |
|
| 99 | 99 | /** @var Executor $executor */ |
| 100 | 100 | return $executor->resultSetToArray($output); |
| 101 | 101 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | return new Command( |
| 134 | 134 | 'SELECT name AS Collation FROM fn_helpcollations();', |
| 135 | - function ($output, $executor) { |
|
| 135 | + function($output, $executor) { |
|
| 136 | 136 | /** @var Executor $executor */ |
| 137 | 137 | return $executor->resultSetToArray($output); |
| 138 | 138 | } |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | return new Command( |
| 149 | 149 | "SELECT @@version", |
| 150 | - function ($output, $executor) { |
|
| 150 | + function($output, $executor) { |
|
| 151 | 151 | /** @var Executor $executor */ |
| 152 | 152 | $output = $executor->resultSetToArray($output); |
| 153 | 153 | $line = $output[0]; |
| 154 | 154 | preg_match('/Microsoft SQL Server +([^ ]+) +([^ ]+) +/', $line, $matches); |
| 155 | - return $matches[1] . ' ' . $matches[2]; |
|
| 155 | + return $matches[1].' '.$matches[2]; |
|
| 156 | 156 | } |
| 157 | 157 | ); |
| 158 | 158 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | return new Command( |
| 19 | 19 | /// @todo use 'SHOW DATABASES' for versions < 5 |
| 20 | 20 | "SELECT SCHEMA_NAME AS 'Database' FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME;", |
| 21 | - function ($output, $executor) { |
|
| 21 | + function($output, $executor) { |
|
| 22 | 22 | /** @var Executor $executor */ |
| 23 | 23 | return $executor->resultSetToArray($output); |
| 24 | 24 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | /// @todo if mysql version is bigger than 8.0, add `WITH mysql_native_password` |
| 42 | 42 | $statements = [ |
| 43 | - "CREATE DATABASE `$dbName`" . ($collation !== null ? " CHARACTER SET $collation" : '') . ';' |
|
| 43 | + "CREATE DATABASE `$dbName`".($collation !== null ? " CHARACTER SET $collation" : '').';' |
|
| 44 | 44 | ]; |
| 45 | 45 | if ($userName != '') { |
| 46 | 46 | $statements[] = "CREATE USER '$userName'@'%' IDENTIFIED BY '$password';"; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | return new Command( |
| 85 | 85 | 'SELECT DISTINCT User FROM mysql.user ORDER BY User;', |
| 86 | - function ($output, $executor) { |
|
| 86 | + function($output, $executor) { |
|
| 87 | 87 | /** @var Executor $executor */ |
| 88 | 88 | return $executor->resultSetToArray($output); |
| 89 | 89 | } |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | return new Command( |
| 120 | 120 | 'SHOW COLLATION;', |
| 121 | - function ($output, $executor) { |
|
| 121 | + function($output, $executor) { |
|
| 122 | 122 | /** @var Executor $executor */ |
| 123 | 123 | $lines = $executor->resultSetToArray($output); |
| 124 | 124 | $out = []; |
| 125 | - foreach($lines as $line) { |
|
| 125 | + foreach ($lines as $line) { |
|
| 126 | 126 | $parts = explode("|", $line, 3); |
| 127 | - $out[] = trim($parts[0]) . ' (' . trim($parts[1]) .')'; |
|
| 127 | + $out[] = trim($parts[0]).' ('.trim($parts[1]).')'; |
|
| 128 | 128 | } |
| 129 | 129 | return $out; |
| 130 | 130 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | return new Command( |
| 141 | 141 | 'SHOW VARIABLES LIKE "version";', |
| 142 | - function ($output, $executor) { |
|
| 142 | + function($output, $executor) { |
|
| 143 | 143 | /** @var Executor $executor */ |
| 144 | 144 | $line = $executor->resultSetToArray($output)[0]; |
| 145 | 145 | $parts = explode('|', $line); |
@@ -15,13 +15,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -55,8 +55,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |