From d0e746fac69a5e9b126d2e121f80df3e0e53ff10 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 28 Aug 2023 23:27:31 +0100 Subject: [PATCH] Fix dropped triggers on rename Signed-off-by: Kamil Tekiela --- libraries/classes/Table.php | 11 +++-------- phpstan-baseline.neon | 5 ----- psalm-baseline.xml | 24 +++++------------------- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/libraries/classes/Table.php b/libraries/classes/Table.php index c0f80d886f..70edd4f28e 100644 --- a/libraries/classes/Table.php +++ b/libraries/classes/Table.php @@ -1531,8 +1531,9 @@ class Table implements Stringable RENAME TABLE ' . $this->getFullName(true) . ' TO ' . $newTable->getFullName(true) . ';'; // I don't think a specific error message for views is necessary - if (! $this->dbi->query($GLOBALS['sql_query'])) { - // TODO: this is dead code, should it be removed? + if ($this->dbi->tryQuery($GLOBALS['sql_query']) === false) { + $this->errors[] = $this->dbi->getError(); + // Restore triggers in the old database if ($handleTriggers) { $this->dbi->selectDb($this->getDbName()); @@ -1541,12 +1542,6 @@ class Table implements Stringable } } - $this->errors[] = sprintf( - __('Failed to rename table %1$s to %2$s!'), - $this->getFullName(), - $newTable->getFullName() - ); - return false; } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d50ecf14ab..670d00be5b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -8365,11 +8365,6 @@ parameters: count: 1 path: libraries/classes/Table.php - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: libraries/classes/Table.php - - message: "#^Parameter \\#1 \\$string of function substr expects string, mixed given\\.$#" count: 2 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 9406be646c..b86f927807 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -13727,8 +13727,7 @@ return $sqlQuery; - - ! $this->dbi->query($GLOBALS['sql_query']) + $rowFields[$key] != 'cc' @@ -13815,7 +13814,7 @@ - + $_POST['criteriaColumnNames'][$column_index] $_POST['criteriaColumnTypes'][$column_index] $column @@ -13830,16 +13829,14 @@ $criteriaValues[0] $operator $operator - $tmp_geom_func $value $values - + $column $operator - $tmp_geom_func $value @@ -13849,28 +13846,17 @@ $values[0] ?? '' $values[1] ?? '' - - $_POST['criteriaColumnNames'][$column_index] - $_POST['criteriaColumnTypes'][$column_index] + $_POST['customWhereClause'] $_POST['orderByColumn'] $_POST['table'] - $operator - $operator $tmp_geom_func - + $_POST['criteriaColumnNames'][$column_index] $_POST['criteriaColumnTypes'][$column_index] $_POST['criteriaValues'][$column_index] - $_POST['geom_func'][$column_index] - - $_POST['criteriaColumnNames'][$column_index] - $_POST['criteriaColumnTypes'][$column_index] - $operator - $operator - $_POST['criteriaColumnOperators'] $columnsToDisplay