diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-19 21:51:12 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-19 21:51:12 +0300 |
commit | cba9b38a2865b1a351a46b4117a4cff106abb2ac (patch) | |
tree | a9a0d387ee3489f17c2e184386cf25dfe85c220b /libraries | |
parent | d631f2fc3dc051da31c6f3961a2523d1b0b360c3 (diff) | |
parent | 987cb5043dba8d385a4890bb171a5bf58bcd10ed (diff) |
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/classes/Controllers/Table/FindReplaceController.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libraries/classes/Controllers/Table/FindReplaceController.php b/libraries/classes/Controllers/Table/FindReplaceController.php index 350d906d85..7a03a3d09b 100644 --- a/libraries/classes/Controllers/Table/FindReplaceController.php +++ b/libraries/classes/Controllers/Table/FindReplaceController.php @@ -321,17 +321,24 @@ class FindReplaceController extends AbstractController if ($useRegex) { $toReplace = $this->getRegexReplaceRows($columnIndex, $find, $replaceWith, $charSet); $sql_query = 'UPDATE ' . Util::backquote($GLOBALS['table']) - . ' SET ' . Util::backquote($column) . ' = CASE'; + . ' SET ' . Util::backquote($column); + if (is_array($toReplace)) { - foreach ($toReplace as $row) { - $sql_query .= "\n WHEN " . Util::backquote($column) - . " = '" . $this->dbi->escapeString($row[0]) - . "' THEN '" . $this->dbi->escapeString($row[1]) . "'"; + if (count($toReplace) > 0) { + $sql_query .= ' = CASE'; + foreach ($toReplace as $row) { + $sql_query .= "\n WHEN " . Util::backquote($column) + . " = '" . $this->dbi->escapeString($row[0]) + . "' THEN '" . $this->dbi->escapeString($row[1]) . "'"; + } + + $sql_query .= ' END'; + } else { + $sql_query .= ' = ' . Util::backquote($column); } } - $sql_query .= ' END' - . ' WHERE ' . Util::backquote($column) + $sql_query .= ' WHERE ' . Util::backquote($column) . " RLIKE '" . $this->dbi->escapeString($find) . "' COLLATE " . $charSet . '_bin'; // here we // change the collation of the 2nd operand to a case sensitive |