@@ -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 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | if ($action == self::EXECUTE_COMMAND) { |
| 69 | 69 | $options[] = '--execute=' . $sqlOrFilename; |
| 70 | 70 | } |
| 71 | - // $env = [ |
|
| 71 | + // $env = [ |
|
| 72 | 72 | // problematic when wrapping the process in a call to `time`... |
| 73 | 73 | //'MYSQL_PWD' => $this->databaseConfiguration['password'], |
| 74 | 74 | //]; |
@@ -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; |
@@ -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 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $this->writeResults($results, $time); |
| 49 | 49 | |
| 50 | - return (int)$results['failed']; |
|
| 50 | + return (int) $results['failed']; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | return $this->executeSqlAction( |
| 61 | 61 | $instanceList, |
| 62 | 62 | 'Listing of users', |
| 63 | - function ($schemaManager, $instanceName) { |
|
| 63 | + function($schemaManager, $instanceName) { |
|
| 64 | 64 | /** @var DatabaseSchemaManager $schemaManager */ |
| 65 | 65 | return $schemaManager->getListUsersSqlAction(); |
| 66 | 66 | } |