@@ -45,8 +45,7 @@ |
||
| 45 | 45 | // From table.inc.php |
| 46 | 46 | $status = $this->status($view); |
| 47 | 47 | $name = $this->page->tableName($status); |
| 48 | - $title = ($status->engine == 'materialized view' ? $this->utils->trans->lang('Materialized view') : |
|
| 49 | - $this->utils->trans->lang('View')) . ': ' . ($name != '' ? $name : $this->utils->str->html($view)); |
|
| 48 | + $title = ($status->engine == 'materialized view' ? $this->utils->trans->lang('Materialized view') : $this->utils->trans->lang('View')) . ': ' . ($name != '' ? $name : $this->utils->str->html($view)); |
|
| 50 | 49 | |
| 51 | 50 | $comment = $status->comment; |
| 52 | 51 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @var SelectEntity|null |
| 36 | 36 | */ |
| 37 | - private SelectEntity|null $selectEntity = null; |
|
| 37 | + private SelectEntity | null $selectEntity = null; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @param AbstractFacade $dbFacade |
@@ -117,11 +117,9 @@ discard block |
||
| 117 | 117 | $value = $this->selectEntity->queryOptions["columns"][$valueKey] ?? []; |
| 118 | 118 | |
| 119 | 119 | $fun = $value["fun"] ?? ''; |
| 120 | - $fieldKey = !$this->selectEntity->select ? $key : |
|
| 121 | - ($value["col"] ?? current($this->selectEntity->select)); |
|
| 120 | + $fieldKey = !$this->selectEntity->select ? $key : ($value["col"] ?? current($this->selectEntity->select)); |
|
| 122 | 121 | $field = $this->selectEntity->fields[$fieldKey]; |
| 123 | - $name = !$field ? ($fun ? "*" : $key) : |
|
| 124 | - $this->page->fieldName($field, $rank); |
|
| 122 | + $name = !$field ? ($fun ? "*" : $key) : $this->page->fieldName($field, $rank); |
|
| 125 | 123 | |
| 126 | 124 | return [$fun, $name, $field]; |
| 127 | 125 | } |
@@ -247,8 +245,7 @@ discard block |
||
| 247 | 245 | private function getRowIdMd5Key(string $key, string $collation): string |
| 248 | 246 | { |
| 249 | 247 | return $this->driver->jush() != 'sql' || |
| 250 | - preg_match("~^utf8~", $collation) ? $key : |
|
| 251 | - "CONVERT($key USING " . $this->driver->charset() . ")"; |
|
| 248 | + preg_match("~^utf8~", $collation) ? $key : "CONVERT($key USING " . $this->driver->charset() . ")"; |
|
| 252 | 249 | } |
| 253 | 250 | |
| 254 | 251 | /** |
@@ -357,8 +354,8 @@ discard block |
||
| 357 | 354 | $query = $this->driver->getRowCountQuery($table, |
| 358 | 355 | $this->selectEntity->where, $this->hasGroupsInFields(), |
| 359 | 356 | $this->selectEntity->group); |
| 360 | - return (int)$this->driver->result($query); |
|
| 361 | - } catch(Exception $_) { |
|
| 357 | + return (int) $this->driver->result($query); |
|
| 358 | + } catch (Exception $_) { |
|
| 362 | 359 | return -1; |
| 363 | 360 | } |
| 364 | 361 | } |
@@ -126,8 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | $foreignKey = $this->foreignKeys[$field->type] ?? null; |
| 128 | 128 | //! Can collide with user defined type |
| 129 | - $typeField = ($foreignKey === null ? $field : |
|
| 130 | - TableFieldEntity::make($this->referencableTables[$foreignKey])); |
|
| 129 | + $typeField = ($foreignKey === null ? $field : TableFieldEntity::make($this->referencableTables[$foreignKey])); |
|
| 131 | 130 | $processedField = $this->driver->processField($field, $typeField); |
| 132 | 131 | $origField = $this->fields[$field->name] ?? null; |
| 133 | 132 | $this->after = ''; |
@@ -374,14 +373,14 @@ discard block |
||
| 374 | 373 | $target .= '<b>' . $this->utils->str->html($foreignKey->schema) . '</b>.'; |
| 375 | 374 | } |
| 376 | 375 | $target = $this->utils->str->html($foreignKey->table) . |
| 377 | - '(' . implode(', ', array_map(function ($key) { |
|
| 376 | + '(' . implode(', ', array_map(function($key) { |
|
| 378 | 377 | return $this->utils->str->html($key); |
| 379 | 378 | }, $foreignKey->target)) . ')'; |
| 380 | 379 | $details[] = [ |
| 381 | 380 | 'name' => $this->utils->str->html($name), |
| 382 | 381 | 'source' => '<i>' . implode( |
| 383 | 382 | '</i>, <i>', |
| 384 | - array_map(function ($key) { |
|
| 383 | + array_map(function($key) { |
|
| 385 | 384 | return $this->utils->str->html($key); |
| 386 | 385 | }, $foreignKey->source) |
| 387 | 386 | ) . '</i>', |
@@ -144,8 +144,7 @@ discard block |
||
| 144 | 144 | $key = $this->driver->escapeId($field->name()); |
| 145 | 145 | $values[] = "$key = VALUES($key)"; |
| 146 | 146 | } |
| 147 | - $dump->suffix = $this->options['data_style'] !== 'INSERT+UPDATE' ? ';' : |
|
| 148 | - "\nON DUPLICATE KEY UPDATE " . implode(', ', $values) . ';'; |
|
| 147 | + $dump->suffix = $this->options['data_style'] !== 'INSERT+UPDATE' ? ';' : "\nON DUPLICATE KEY UPDATE " . implode(', ', $values) . ';'; |
|
| 149 | 148 | |
| 150 | 149 | return $keys; |
| 151 | 150 | } |
@@ -171,7 +170,7 @@ discard block |
||
| 171 | 170 | |
| 172 | 171 | if ($dump->insert === '') { |
| 173 | 172 | $dump->insert = 'INSERT INTO ' . $this->driver->escapeTableName($dump->table) . ' (' . |
| 174 | - implode(', ', array_map(function ($key) { |
|
| 173 | + implode(', ', array_map(function($key) { |
|
| 175 | 174 | return $this->driver->escapeId($key); |
| 176 | 175 | }, $keys)) . ') VALUES'; |
| 177 | 176 | } |
@@ -197,8 +196,7 @@ discard block |
||
| 197 | 196 | $fields = $this->options['format'] !== 'sql' ? [] : $this->driver->fields($dump->table); |
| 198 | 197 | $keys = []; |
| 199 | 198 | $fetchFunction = $dump->table !== '' ? |
| 200 | - fn($statement) => $statement->fetchAssoc() : |
|
| 201 | - fn($statement) => $statement->fetchRow(); |
|
| 199 | + fn($statement) => $statement->fetchAssoc() : fn($statement) => $statement->fetchRow(); |
|
| 202 | 200 | while ($row = $fetchFunction($statement)) { |
| 203 | 201 | if (empty($keys)) { |
| 204 | 202 | $keys = $this->getDataRowKeys($dump, $row, $statement); |
@@ -467,12 +465,10 @@ discard block |
||
| 467 | 465 | // From dump.inc.php create_routine() |
| 468 | 466 | $routineName = $this->driver->escapeId(trim($routine->name)); |
| 469 | 467 | $routineParams = $this->getRoutineParams($routineInfo->params); |
| 470 | - $routineReturns = $routine->type !== 'FUNCTION' ? '' : |
|
| 471 | - ' RETURNS' . $this->driver->processType($routineInfo->return, 'CHARACTER SET'); |
|
| 468 | + $routineReturns = $routine->type !== 'FUNCTION' ? '' : ' RETURNS' . $this->driver->processType($routineInfo->return, 'CHARACTER SET'); |
|
| 472 | 469 | $routineLanguage = $routineInfo->language ? " LANGUAGE {$routineInfo->language}" : ''; |
| 473 | 470 | $definition = rtrim($routineInfo->definition, ';'); |
| 474 | - $routineDefinition = $this->driver->jush() !== 'pgsql' ? "\n$definition;" : |
|
| 475 | - ' AS ' . $this->driver->quote($definition); |
|
| 471 | + $routineDefinition = $this->driver->jush() !== 'pgsql' ? "\n$definition;" : ' AS ' . $this->driver->quote($definition); |
|
| 476 | 472 | |
| 477 | 473 | return "CREATE {$routine->type} $routineName ($routineParams)" . |
| 478 | 474 | "{$routineReturns}{$routineLanguage}{$routineDefinition};"; |
@@ -638,7 +634,7 @@ discard block |
||
| 638 | 634 | * |
| 639 | 635 | * @return array|string |
| 640 | 636 | */ |
| 641 | - public function exportDatabases(array $databases, array $options): array|string |
|
| 637 | + public function exportDatabases(array $databases, array $options): array | string |
|
| 642 | 638 | { |
| 643 | 639 | // From dump.inc.php |
| 644 | 640 | // $tables = array_flip($options['tables']) + array_flip($options['data']); |
@@ -279,8 +279,7 @@ |
||
| 279 | 279 | foreach ($databases as $database => $tables) { |
| 280 | 280 | try { |
| 281 | 281 | $this->dumpDatabase($database, $tables); |
| 282 | - } |
|
| 283 | - catch (Exception $e) { |
|
| 282 | + } catch (Exception $e) { |
|
| 284 | 283 | return $e->getMessage(); |
| 285 | 284 | } |
| 286 | 285 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * @var AppDriver|null |
| 16 | 16 | */ |
| 17 | - protected AppDriver|null $driver = null; |
|
| 17 | + protected AppDriver | null $driver = null; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var AppPage |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | public function getSelectDataValues(): array |
| 31 | 31 | { |
| 32 | 32 | //! use insertOrUpdate() in all drivers |
| 33 | - return $this->driver->jush() !== 'sql' ? ['', 'TRUNCATE+INSERT', 'INSERT'] : |
|
| 34 | - ['', 'TRUNCATE+INSERT', 'INSERT', 'INSERT+UPDATE']; |
|
| 33 | + return $this->driver->jush() !== 'sql' ? ['', 'TRUNCATE+INSERT', 'INSERT'] : ['', 'TRUNCATE+INSERT', 'INSERT', 'INSERT+UPDATE']; |
|
| 35 | 34 | } |
| 36 | 35 | |
| 37 | 36 | private function getDataRowOptions(string $database, string $table): array |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | return [ |
| 27 | 27 | 'select' => $select, |
| 28 | - 'values' => (array)$options["columns"], |
|
| 28 | + 'values' => (array) $options["columns"], |
|
| 29 | 29 | 'columns' => $columns, |
| 30 | 30 | 'functions' => $this->driver->functions(), |
| 31 | 31 | 'grouping' => $this->driver->grouping(), |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | return [ |
| 51 | 51 | // 'where' => $where, |
| 52 | - 'values' => (array)$options["where"], |
|
| 52 | + 'values' => (array) $options["where"], |
|
| 53 | 53 | 'columns' => $columns, |
| 54 | 54 | 'indexes' => $indexes, |
| 55 | 55 | 'operators' => $this->driver->operators(), |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | private function getSortingOptions(array $columns, array $options): array |
| 69 | 69 | { |
| 70 | 70 | $values = []; |
| 71 | - $descs = (array)$options["desc"]; |
|
| 72 | - foreach ((array)$options["order"] as $key => $value) { |
|
| 71 | + $descs = (array) $options["desc"]; |
|
| 72 | + foreach ((array) $options["order"] as $key => $value) { |
|
| 73 | 73 | $values[] = [ |
| 74 | 74 | 'col' => $value, |
| 75 | 75 | 'desc' => $descs[$key] ?? 0, |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $col = $value['col']; |
| 287 | 287 | $prefix = ''; |
| 288 | 288 | if ($op === 'FIND_IN_SET') { |
| 289 | - $prefix = $op .'(' . $this->driver->quote($value['val']) . ', '; |
|
| 289 | + $prefix = $op . '(' . $this->driver->quote($value['val']) . ', '; |
|
| 290 | 290 | } |
| 291 | 291 | $condition = $this->getWhereCondition($value, $fields); |
| 292 | 292 | if ($col !== '') { |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | private function getMatchExpression(IndexEntity $index, int $i): string |
| 317 | 317 | { |
| 318 | - $columns = array_map(function ($column) { |
|
| 318 | + $columns = array_map(function($column) { |
|
| 319 | 319 | return $this->driver->escapeId($column); |
| 320 | 320 | }, $index->columns); |
| 321 | 321 | $fulltext = $this->utils->input->values['fulltext'][$i] ?? ''; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | foreach ((array) $this->utils->input->values['where'] as $value) { |
| 344 | - if (($value['col'] !== '' || $value['val'] !== '') && |
|
| 344 | + if (($value['col'] !== '' || $value['val'] !== '') && |
|
| 345 | 345 | in_array($value['op'], $this->driver->operators())) { |
| 346 | 346 | $selectEntity->where[] = $this |
| 347 | 347 | ->getSelectExpression($value, $selectEntity->fields); |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | /** |
| 106 | 106 | * @var string|null |
| 107 | 107 | */ |
| 108 | - public string|null $error = null; |
|
| 108 | + public string | null $error = null; |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * @var TableSelectEntity |