Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db_get_table() also check suffix for legacy-style names
If $db_table_plugin_prefix contains 'mantis', db_get_table() function will incorrectly process a plugin's tables as if they were legacy tables (i.e. 'Mantis 1.2 style', with a 'mantis_' prefix). If $db_table_suffix also is not set to '_table', then the generated table name will be incorrect (e.g. with the Source Integration plugin, changeset table will be generated as 'mantis_Source_ch_suffix' instead of 'mantis_mantis_Source_changeset_suffix'), causing the installation by plugin_upgrade() to fail and invalid tables to be created. We now use a regex to check for legacy tables, verifying that it ends with '_table' in addition to beginning with 'mantis_'. This basically reverts commit 38bc024 (issue #16038). Note on performance: while preg_match() is slower than strpos(), it is actually more efficient to use that, considering that we would need a second function call to check for the suffix, as well as a substr() call to extract the table name, while preg_match() does it all at once. Fixes #20168 Backported from master 4917320.
- Loading branch information