mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-02 23:07:39 +02:00
[ticket/9892] Table prefix lengths influence index lengths in db_tools
PHPBB3-9892
This commit is contained in:
@@ -419,7 +419,7 @@ class phpbb_db_tools
|
|||||||
|
|
||||||
if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
|
if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
|
||||||
{
|
{
|
||||||
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
|
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// here we add the definition of the new column to the list of columns
|
// here we add the definition of the new column to the list of columns
|
||||||
@@ -2056,9 +2056,11 @@ class phpbb_db_tools
|
|||||||
{
|
{
|
||||||
$statements = array();
|
$statements = array();
|
||||||
|
|
||||||
if (strlen($table_name . $index_name) > 30)
|
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
||||||
|
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
||||||
{
|
{
|
||||||
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
|
$max_length = $table_prefix + 24;
|
||||||
|
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->sql_layer)
|
switch ($this->sql_layer)
|
||||||
@@ -2091,9 +2093,11 @@ class phpbb_db_tools
|
|||||||
{
|
{
|
||||||
$statements = array();
|
$statements = array();
|
||||||
|
|
||||||
if (strlen($table_name . $index_name) > 30)
|
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
||||||
|
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
||||||
{
|
{
|
||||||
trigger_error("Index name '${table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
|
$max_length = $table_prefix + 24;
|
||||||
|
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove index length unless MySQL4
|
// remove index length unless MySQL4
|
||||||
|
@@ -2321,7 +2321,7 @@ class updater_db_tools
|
|||||||
|
|
||||||
if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
|
if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
|
||||||
{
|
{
|
||||||
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
|
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// here we add the definition of the new column to the list of columns
|
// here we add the definition of the new column to the list of columns
|
||||||
@@ -3891,9 +3891,11 @@ class updater_db_tools
|
|||||||
{
|
{
|
||||||
$statements = array();
|
$statements = array();
|
||||||
|
|
||||||
if (strlen($table_name . $index_name) > 30)
|
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
||||||
|
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
||||||
{
|
{
|
||||||
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
|
$max_length = $table_prefix + 24;
|
||||||
|
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->sql_layer)
|
switch ($this->sql_layer)
|
||||||
@@ -3926,9 +3928,11 @@ class updater_db_tools
|
|||||||
{
|
{
|
||||||
$statements = array();
|
$statements = array();
|
||||||
|
|
||||||
if (strlen($table_name . $index_name) > 30)
|
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
||||||
|
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
||||||
{
|
{
|
||||||
trigger_error("Index name '${table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
|
$max_length = $table_prefix + 24;
|
||||||
|
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove index length unless MySQL4
|
// remove index length unless MySQL4
|
||||||
|
Reference in New Issue
Block a user