diff options
author | rxu <rxu@mail.ru> | 2016-07-24 00:24:32 +0700 |
---|---|---|
committer | rxu <rxu@mail.ru> | 2016-07-24 02:31:44 +0700 |
commit | 8cf2790d5577f7e2398d5017216d3c5540cb0eb0 (patch) | |
tree | a67486714f94ab5a8e0aec90a192c0837f4acbb9 /phpBB/phpbb/db/migration/tool | |
parent | eaafb758ce5be55dd762c039fd7a746aa6c64b58 (diff) | |
download | forums-8cf2790d5577f7e2398d5017216d3c5540cb0eb0.tar forums-8cf2790d5577f7e2398d5017216d3c5540cb0eb0.tar.gz forums-8cf2790d5577f7e2398d5017216d3c5540cb0eb0.tar.bz2 forums-8cf2790d5577f7e2398d5017216d3c5540cb0eb0.tar.xz forums-8cf2790d5577f7e2398d5017216d3c5540cb0eb0.zip |
[ticket/14703] Add test for the case multiple parent module_langname found
PHPBB3-14703
Diffstat (limited to 'phpBB/phpbb/db/migration/tool')
-rw-r--r-- | phpBB/phpbb/db/migration/tool/module.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 0869ce37d3..67daea5482 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -495,13 +495,13 @@ class module implements \phpbb\db\migration\tool\tool_interface // Several modules with the given module_langname were found // Try to determine the parent_id by the neighbour module parent default: - if (!empty($data) && (isset($data['before']) || isset($data['after']))) + if (isset($data['before']) || isset($data['after'])) { $neighbour_module_langname = isset($data['before']) ? $data['before'] : $data['after']; $sql = 'SELECT parent_id - FROM ' . MODULES_TABLE . ' - WHERE module_langname ' . $this->db->sql_escape($neighbour_module_langname) . ' - AND ' . $this->db->sql_in_set('parent_id', $ids); + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($neighbour_module_langname) . "' + AND " . $this->db->sql_in_set('parent_id', $ids); $result = $this->db->sql_query($sql); $parent_id = (int) $this->db->sql_fetchfield('parent_id'); if (!$parent_id) @@ -509,8 +509,10 @@ class module implements \phpbb\db\migration\tool\tool_interface throw new \phpbb\db\migration\exception('PARENT_MODULE_FIND_ERROR', $data['parent_id']); } } - else + else if (!empty($data)) { + // Only throw exception whhile adding module when the $data is not empty + // Otherwise it's just removing or existance checking and no need for exception throw new \phpbb\db\migration\exception('MODULE_EXIST_MULTIPLE', $parent_id); } break; |