- adjust db_tools again to not remove any schema (they may be required)

- fill dbms version if not yet filled

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9351 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-02-28 19:22:27 +00:00
parent bfa4e6038e
commit 62973fa504
4 changed files with 26 additions and 35 deletions

View file

@ -510,6 +510,12 @@ class acp_main
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
}
// Fill dbms version if not yet filled
if (empty($config['dbms_version']))
{
set_config('dbms_version', $db->sql_server_info(true));
}
$this->tpl_name = 'acp_main';
$this->page_title = 'ACP_MAIN';
}

View file

@ -311,9 +311,6 @@ class phpbb_db_tools
$this->sql_layer = $this->db->sql_layer;
break;
}
// Because we only need the dbms type map of one database type, we "adjust" it now. ;)
$this->dbms_type_map = $this->dbms_type_map[$this->sql_layer];
}
/**
@ -877,55 +874,37 @@ class phpbb_db_tools
if (strpos($column_data[0], ':') !== false)
{
list($orig_column_type, $column_length) = explode(':', $column_data[0]);
if (!is_array($this->dbms_type_map[$orig_column_type . ':']))
if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']))
{
$column_type = sprintf($this->db->dbms_type_map[$orig_column_type . ':'], $column_length);
}
$orig_column_type .= ':';
}
else
{
$orig_column_type = $column_data[0];
$column_type = $this->db->dbms_type_map[$column_data[0]];
}
// Get type
if (strpos($column_data[0], ':') !== false)
{
list($orig_column_type, $column_length) = explode(':', $column_data[0]);
if (!is_array($this->dbms_type_map[$orig_column_type . ':']))
{
$column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'], $column_length);
$column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length);
}
else
{
if (isset($this->dbms_type_map[$orig_column_type . ':']['rule']))
if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule']))
{
switch ($this->dbms_type_map[$orig_column_type . ':']['rule'][0])
switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0])
{
case 'div':
$column_length /= $this->dbms_type_map[$orig_column_type . ':']['rule'][1];
$column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1];
$column_length = ceil($column_length);
$column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length);
$column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length);
break;
}
}
if (isset($this->dbms_type_map[$orig_column_type . ':']['limit']))
if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit']))
{
switch ($this->dbms_type_map[$orig_column_type . ':']['limit'][0])
switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0])
{
case 'mult':
$column_length *= $this->dbms_type_map[$orig_column_type . ':']['limit'][1];
if ($column_length > $this->dbms_type_map[$orig_column_type . ':']['limit'][2])
$column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1];
if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2])
{
$column_type = $this->dbms_type_map[$orig_column_type . ':']['limit'][3];
$column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3];
}
else
{
$column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length);
$column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length);
}
break;
}
@ -936,7 +915,7 @@ class phpbb_db_tools
else
{
$orig_column_type = $column_data[0];
$column_type = $this->dbms_type_map[$column_data[0]];
$column_type = $this->dbms_type_map[$this->sql_layer][$column_data[0]];
}
// Adjust default value if db-dependant specified

View file

@ -502,7 +502,7 @@ function user_delete($mode, $user_id, $post_username = false)
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
// Delete the user_id from the banlist
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
WHERE ban_userid = ' . $user_id;
$db->sql_query($sql);

View file

@ -183,6 +183,12 @@ class install_update extends module
);
}
// Fill DB version
if (empty($config['dbms_version']))
{
set_config('dbms_version', $db->sql_server_info(true));
}
if ($this->test_update === false)
{
// Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present