From aef2a9601214b6021589fa64e6961394aebf8618 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Sun, 2 Apr 2023 23:13:30 +0100 Subject: [PATCH] Move getDefaultPmaTableNames out of the loop Signed-off-by: Kamil Tekiela --- libraries/classes/ConfigStorage/Relation.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/classes/ConfigStorage/Relation.php b/libraries/classes/ConfigStorage/Relation.php index ad49de25e0..f003dcbdbe 100644 --- a/libraries/classes/ConfigStorage/Relation.php +++ b/libraries/classes/ConfigStorage/Relation.php @@ -1556,7 +1556,16 @@ class Relation $tableNameReplacements = $this->getTableReplacementNames($tablesToFeatures); - $createQueries = null; + $createQueries = []; + if ($create) { + $createQueries = $this->getDefaultPmaTableNames($tableNameReplacements); + if (! $this->dbi->selectDb($db, Connection::TYPE_CONTROL)) { + $GLOBALS['message'] = $this->dbi->getError(Connection::TYPE_CONTROL); + + return; + } + } + $foundOne = false; foreach ($tablesToFeatures as $table => $feature) { // Check if the table already exists @@ -1564,15 +1573,6 @@ class Relation // if no replacement exists if (! in_array($tableNameReplacements[$table] ?? $table, $existingTables)) { if ($create) { - if ($createQueries === null) { // first create - $createQueries = $this->getDefaultPmaTableNames($tableNameReplacements); - if (! $this->dbi->selectDb($db, Connection::TYPE_CONTROL)) { - $GLOBALS['message'] = $this->dbi->getError(Connection::TYPE_CONTROL); - - return; - } - } - $this->dbi->tryQuery($createQueries[$table], Connection::TYPE_CONTROL); $error = $this->dbi->getError(Connection::TYPE_CONTROL);