aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/tools/tools.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2018-01-07 11:02:31 +0100
committerMarc Alexander <admin@m-a-styles.de>2018-01-07 11:02:31 +0100
commit1b4bad6583ffa8a7ba8a1e7f5f9c29c5654bba99 (patch)
treed70037f3f547a71e4a6b87bcddb31aeb19db7328 /phpBB/phpbb/db/tools/tools.php
parent3ae016954212e90032a10d1427c34a4ff9d9637c (diff)
parent182a96f2738316adcb292816a9ac8af0e0cb5866 (diff)
downloadforums-1b4bad6583ffa8a7ba8a1e7f5f9c29c5654bba99.tar
forums-1b4bad6583ffa8a7ba8a1e7f5f9c29c5654bba99.tar.gz
forums-1b4bad6583ffa8a7ba8a1e7f5f9c29c5654bba99.tar.bz2
forums-1b4bad6583ffa8a7ba8a1e7f5f9c29c5654bba99.tar.xz
forums-1b4bad6583ffa8a7ba8a1e7f5f9c29c5654bba99.zip
Merge remote-tracking branch 'upstream/3.2.x' into prep-release-3.2.2
Diffstat (limited to 'phpBB/phpbb/db/tools/tools.php')
-rw-r--r--phpBB/phpbb/db/tools/tools.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/phpBB/phpbb/db/tools/tools.php b/phpBB/phpbb/db/tools/tools.php
index 2f891e43d5..d21d34b8a9 100644
--- a/phpBB/phpbb/db/tools/tools.php
+++ b/phpBB/phpbb/db/tools/tools.php
@@ -1561,7 +1561,8 @@ class tools implements tools_interface
*/
protected function check_index_name_length($table_name, $index_name, $throw_error = true)
{
- if (strlen($index_name) > 30)
+ $max_index_name_length = $this->get_max_index_name_length();
+ if (strlen($index_name) > $max_index_name_length)
{
// Try removing the table prefix if it's at the beginning
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
@@ -1582,7 +1583,7 @@ class tools implements tools_interface
if ($throw_error)
{
- trigger_error("Index name '$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
+ trigger_error("Index name '$index_name' on table '$table_name' is too long. The maximum is $max_index_name_length characters.", E_USER_ERROR);
}
}
@@ -1590,6 +1591,16 @@ class tools implements tools_interface
}
/**
+ * Get maximum index name length. Might vary depending on db type
+ *
+ * @return int Maximum index name length
+ */
+ protected function get_max_index_name_length()
+ {
+ return 30;
+ }
+
+ /**
* {@inheritDoc}
*/
function sql_list_index($table_name)