mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Check the prefix length to ensure that the key names are within the maximum for that DBMS
git-svn-id: file:///svn/phpbb/trunk@6268 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
ca2a672d20
commit
a4c580e8f8
1 changed files with 39 additions and 0 deletions
|
@ -1299,6 +1299,10 @@ class install_install extends module
|
|||
{
|
||||
foreach ($row['cat'] as $cat_name)
|
||||
{
|
||||
if (!isset($categories[$cat_name]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$module_data = array(
|
||||
'module_basename' => $module_basename,
|
||||
'module_enabled' => 1,
|
||||
|
@ -1637,6 +1641,41 @@ class install_install extends module
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check the prefix length to ensure that index names are not too long
|
||||
switch ($dbms)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
case 'postgres':
|
||||
$prefix_length = 36;
|
||||
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
$prefix_length = 90;
|
||||
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
case 'sqlite':
|
||||
$prefix_length = 200;
|
||||
|
||||
break;
|
||||
|
||||
case 'firebird':
|
||||
$prefix_length = 6;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (strlen($table_prefix) > $prefix_length)
|
||||
{
|
||||
$error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try and connect ...
|
||||
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false)))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue