mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
the end of an era...
- MySQL < 4.1.3 support is removed - renamed mysql4 to mysql, no need to cause confusion - changed the cfg cacher, reduces file system lookups and include count by two on every page load git-svn-id: file:///svn/phpbb/trunk@8307 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -89,7 +89,6 @@ class acp_database
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysqli':
|
||||
case 'mysql4':
|
||||
case 'mysql':
|
||||
$extractor = new mysql_extractor($download, $store, $format, $filename, $time);
|
||||
break;
|
||||
@@ -317,7 +316,6 @@ class acp_database
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
case 'sqlite':
|
||||
while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false)
|
||||
@@ -592,28 +590,16 @@ class mysql_extractor extends base_extractor
|
||||
function write_table($table_name)
|
||||
{
|
||||
global $db;
|
||||
static $new_extract;
|
||||
|
||||
if ($new_extract === null)
|
||||
{
|
||||
if ($db->sql_layer === 'mysqli' || version_compare($db->mysql_version, '3.23.20', '>='))
|
||||
{
|
||||
$new_extract = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_extract = false;
|
||||
}
|
||||
}
|
||||
$sql = 'SHOW CREATE TABLE ' . $table_name;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
||||
if ($new_extract)
|
||||
{
|
||||
$this->new_write_table($table_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->old_write_table($table_name);
|
||||
}
|
||||
$sql_data = '# Table: ' . $table_name . "\n";
|
||||
$sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
|
||||
$this->flush($sql_data . $row['Create Table'] . ";\n\n");
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
function write_data($table_name)
|
||||
@@ -791,113 +777,6 @@ class mysql_extractor extends base_extractor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function new_write_table($table_name)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = 'SHOW CREATE TABLE ' . $table_name;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
||||
$sql_data = '# Table: ' . $table_name . "\n";
|
||||
$sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
|
||||
$this->flush($sql_data . $row['Create Table'] . ";\n\n");
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
function old_write_table($table_name)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql_data = '# Table: ' . $table_name . "\n";
|
||||
$sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
|
||||
$sql_data .= "CREATE TABLE $table_name(\n";
|
||||
$rows = array();
|
||||
|
||||
$sql = "SHOW FIELDS
|
||||
FROM $table_name";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$line = ' ' . $row['Field'] . ' ' . $row['Type'];
|
||||
|
||||
if (!is_null($row['Default']))
|
||||
{
|
||||
$line .= " DEFAULT '{$row['Default']}'";
|
||||
}
|
||||
|
||||
if ($row['Null'] != 'YES')
|
||||
{
|
||||
$line .= ' NOT NULL';
|
||||
}
|
||||
|
||||
if ($row['Extra'] != '')
|
||||
{
|
||||
$line .= ' ' . $row['Extra'];
|
||||
}
|
||||
|
||||
$rows[] = $line;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SHOW KEYS
|
||||
FROM $table_name";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$index = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$kname = $row['Key_name'];
|
||||
|
||||
if ($kname != 'PRIMARY')
|
||||
{
|
||||
if ($row['Non_unique'] == 0)
|
||||
{
|
||||
$kname = "UNIQUE|$kname";
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['Sub_part'])
|
||||
{
|
||||
$row['Column_name'] .= '(' . $row['Sub_part'] . ')';
|
||||
}
|
||||
$index[$kname][] = $row['Column_name'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($index as $key => $columns)
|
||||
{
|
||||
$line = ' ';
|
||||
|
||||
if ($key == 'PRIMARY')
|
||||
{
|
||||
$line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')';
|
||||
}
|
||||
else if (strpos($key, 'UNIQUE') === 0)
|
||||
{
|
||||
$line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')';
|
||||
}
|
||||
else if (strpos($key, 'FULLTEXT') === 0)
|
||||
{
|
||||
$line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$line .= "KEY $key (" . implode(', ', $columns) . ')';
|
||||
}
|
||||
|
||||
$rows[] = $line;
|
||||
}
|
||||
|
||||
$sql_data .= implode(",\n", $rows);
|
||||
$sql_data .= "\n);\n\n";
|
||||
|
||||
$this->flush($sql_data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1649,7 +1649,7 @@ class acp_forums
|
||||
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql4':
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
|
||||
// Delete everything else and thank MySQL for offering multi-table deletion
|
||||
|
@@ -1351,7 +1351,6 @@ class acp_profile
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
|
||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||
|
@@ -1782,8 +1782,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||
$theme_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['theme_name'], $style_row['theme_copyright'], $config['version']), $this->theme_cfg);
|
||||
|
||||
// Read old cfg file
|
||||
$items = cache::obtain_cfg_items($style_row);
|
||||
$items = $items['theme'];
|
||||
$items = cache::obtain_cfg_item($style_row, 'theme');
|
||||
|
||||
if (!isset($items['parse_css_file']))
|
||||
{
|
||||
|
@@ -1141,7 +1141,6 @@ class acp_users
|
||||
break;
|
||||
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
$right_delim = $left_delim = '`';
|
||||
break;
|
||||
|
@@ -316,51 +316,46 @@ class cache
|
||||
|
||||
/**
|
||||
* Obtain cfg file data
|
||||
*
|
||||
* @param array $theme An array containing the path to the item
|
||||
*
|
||||
* @param string $item The specific item to get: 'theme', 'template', or 'imageset'
|
||||
*
|
||||
*/
|
||||
public static function obtain_cfg_items($theme)
|
||||
public static function obtain_cfg_item($theme, $item = 'theme')
|
||||
{
|
||||
global $config, $phpbb_root_path, $cache;
|
||||
|
||||
$parsed_items = array(
|
||||
'theme' => array(),
|
||||
'template' => array(),
|
||||
'imageset' => array()
|
||||
);
|
||||
$parsed_array = $cache->get('_cfg_' . $item . '_' . $theme[$item . '_path']);
|
||||
|
||||
foreach ($parsed_items as $key => $parsed_array)
|
||||
if ($parsed_array === false)
|
||||
{
|
||||
$parsed_array = $cache->get('_cfg_' . $key . '_' . $theme[$key . '_path']);
|
||||
|
||||
if ($parsed_array === false)
|
||||
{
|
||||
$parsed_array = array();
|
||||
}
|
||||
|
||||
$reparse = false;
|
||||
$filename = $phpbb_root_path . 'styles/' . $theme[$key . '_path'] . '/' . $key . '/' . $key . '.cfg';
|
||||
|
||||
if (!file_exists($filename))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
|
||||
{
|
||||
$reparse = true;
|
||||
}
|
||||
|
||||
// Re-parse cfg file
|
||||
if ($reparse)
|
||||
{
|
||||
$parsed_array = parse_cfg_file($filename);
|
||||
$parsed_array['filetime'] = @filemtime($filename);
|
||||
|
||||
$cache->put('_cfg_' . $key . '_' . $theme[$key . '_path'], $parsed_array);
|
||||
}
|
||||
$parsed_items[$key] = $parsed_array;
|
||||
$parsed_array = array();
|
||||
}
|
||||
|
||||
return $parsed_items;
|
||||
$reparse = false;
|
||||
$filename = $phpbb_root_path . 'styles/' . $theme[$item . '_path'] . '/' . $item . '/' . $item . '.cfg';
|
||||
|
||||
if (!file_exists($filename))
|
||||
{
|
||||
return $parsed_array;
|
||||
}
|
||||
|
||||
if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
|
||||
{
|
||||
$reparse = true;
|
||||
}
|
||||
|
||||
// Re-parse cfg file
|
||||
if ($reparse)
|
||||
{
|
||||
$parsed_array = parse_cfg_file($filename);
|
||||
$parsed_array['filetime'] = @filemtime($filename);
|
||||
|
||||
$cache->put('_cfg_' . $item . '_' . $theme[$item . '_path'], $parsed_array);
|
||||
}
|
||||
|
||||
return $parsed_array;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -31,7 +31,7 @@ class phpbb_db_tools
|
||||
var $sql_layer = '';
|
||||
|
||||
var $dbms_type_map = array(
|
||||
'mysql_41' => array(
|
||||
'mysql' => array(
|
||||
'INT:' => 'int(%d)',
|
||||
'BINT' => 'bigint(20)',
|
||||
'UINT' => 'mediumint(8) UNSIGNED',
|
||||
@@ -61,36 +61,6 @@ class phpbb_db_tools
|
||||
'VARBINARY' => 'varbinary(255)',
|
||||
),
|
||||
|
||||
'mysql_40' => array(
|
||||
'INT:' => 'int(%d)',
|
||||
'BINT' => 'bigint(20)',
|
||||
'UINT' => 'mediumint(8) UNSIGNED',
|
||||
'UINT:' => 'int(%d) UNSIGNED',
|
||||
'TINT:' => 'tinyint(%d)',
|
||||
'USINT' => 'smallint(4) UNSIGNED',
|
||||
'BOOL' => 'tinyint(1) UNSIGNED',
|
||||
'VCHAR' => 'varbinary(255)',
|
||||
'VCHAR:' => 'varbinary(%d)',
|
||||
'CHAR:' => 'binary(%d)',
|
||||
'XSTEXT' => 'blob',
|
||||
'XSTEXT_UNI'=> 'blob',
|
||||
'STEXT' => 'blob',
|
||||
'STEXT_UNI' => 'blob',
|
||||
'TEXT' => 'blob',
|
||||
'TEXT_UNI' => 'blob',
|
||||
'MTEXT' => 'mediumblob',
|
||||
'MTEXT_UNI' => 'mediumblob',
|
||||
'TIMESTAMP' => 'int(11) UNSIGNED',
|
||||
'DECIMAL' => 'decimal(5,2)',
|
||||
'DECIMAL:' => 'decimal(%d,2)',
|
||||
'PDECIMAL' => 'decimal(6,3)',
|
||||
'PDECIMAL:' => 'decimal(%d,3)',
|
||||
'VCHAR_UNI' => 'blob',
|
||||
'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')),
|
||||
'VCHAR_CI' => 'blob',
|
||||
'VARBINARY' => 'varbinary(255)',
|
||||
),
|
||||
|
||||
'firebird' => array(
|
||||
'INT:' => 'INTEGER',
|
||||
'BINT' => 'DOUBLE PRECISION',
|
||||
@@ -244,7 +214,7 @@ class phpbb_db_tools
|
||||
|
||||
// A list of types being unsigned for better reference in some db's
|
||||
var $unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
|
||||
var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite');
|
||||
var $supported_dbms = array('firebird', 'mssql', 'mysql', 'oracle', 'postgres', 'sqlite');
|
||||
|
||||
/**
|
||||
* Set this to true if you only want to return the 'to-be-executed' SQL statement(s) (as an array).
|
||||
@@ -260,26 +230,10 @@ class phpbb_db_tools
|
||||
// Determine mapping database type
|
||||
switch ($this->db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
$this->sql_layer = 'mysql_40';
|
||||
break;
|
||||
|
||||
case 'mysql4':
|
||||
if (version_compare($this->db->mysql_version, '4.1.3', '>='))
|
||||
{
|
||||
$this->sql_layer = 'mysql_41';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sql_layer = 'mysql_40';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'mysqli':
|
||||
$this->sql_layer = 'mysql_41';
|
||||
$this->sql_layer = 'mysql';
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
$this->sql_layer = 'mssql';
|
||||
break;
|
||||
@@ -453,8 +407,7 @@ class phpbb_db_tools
|
||||
{
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
|
||||
$sql = "SHOW COLUMNS FROM $table";
|
||||
$result = $this->db->sql_query($sql);
|
||||
@@ -731,8 +684,7 @@ class phpbb_db_tools
|
||||
$return_array['column_type_sql_default'] = $sql_default;
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$sql .= " {$column_type} ";
|
||||
|
||||
// For hexadecimal values do not use single quotes
|
||||
@@ -748,7 +700,7 @@ class phpbb_db_tools
|
||||
{
|
||||
$sql .= ' auto_increment';
|
||||
}
|
||||
else if ($this->sql_layer === 'mysql_41' && $column_data[2] == 'true_sort')
|
||||
else if ($column_data[2] == 'true_sort')
|
||||
{
|
||||
$sql .= ' COLLATE utf8_unicode_ci';
|
||||
}
|
||||
@@ -835,8 +787,7 @@ class phpbb_db_tools
|
||||
$statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default'];
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'];
|
||||
break;
|
||||
|
||||
@@ -927,8 +878,7 @@ class phpbb_db_tools
|
||||
$statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']';
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`';
|
||||
break;
|
||||
|
||||
@@ -1015,8 +965,7 @@ class phpbb_db_tools
|
||||
$statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name;
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name;
|
||||
break;
|
||||
|
||||
@@ -1054,8 +1003,7 @@ class phpbb_db_tools
|
||||
$statements[] = $sql;
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')';
|
||||
break;
|
||||
|
||||
@@ -1132,8 +1080,7 @@ class phpbb_db_tools
|
||||
$statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
|
||||
break;
|
||||
|
||||
@@ -1161,8 +1108,7 @@ class phpbb_db_tools
|
||||
$statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
|
||||
break;
|
||||
|
||||
@@ -1221,8 +1167,7 @@ class phpbb_db_tools
|
||||
$col = 'index_name';
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$sql = 'SHOW KEYS
|
||||
FROM ' . $table_name;
|
||||
$col = 'Key_name';
|
||||
@@ -1244,7 +1189,7 @@ class phpbb_db_tools
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique'])
|
||||
if ($this->sql_layer == 'mysql' && !$row['Non_unique'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1286,8 +1231,7 @@ class phpbb_db_tools
|
||||
$statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql'];
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'mysql':
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql'];
|
||||
break;
|
||||
|
||||
|
@@ -19,21 +19,18 @@ if (!defined('IN_PHPBB'))
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* MySQL4 Database Abstraction Layer
|
||||
* MySQL Database Abstraction Layer
|
||||
* Compatible with:
|
||||
* MySQL 3.23+
|
||||
* MySQL 4.0+
|
||||
* MySQL 4.1+
|
||||
* MySQL 5.0+
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_mysql extends dbal
|
||||
{
|
||||
var $mysql_version;
|
||||
var $multi_insert = true;
|
||||
|
||||
// Supports multiple table deletion
|
||||
var $multi_table_deletion = false;
|
||||
var $multi_table_deletion = true;
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
@@ -46,49 +43,37 @@ class dbal_mysql extends dbal
|
||||
$this->server = $sqlserver . (($port) ? ':' . $port : '');
|
||||
$this->dbname = $database;
|
||||
|
||||
$this->sql_layer = 'mysql4';
|
||||
|
||||
$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
|
||||
|
||||
if ($this->db_connect_id && $this->dbname != '')
|
||||
{
|
||||
if (@mysql_select_db($this->dbname, $this->db_connect_id))
|
||||
{
|
||||
// Determine what version we are using and if it natively supports UNICODE
|
||||
$this->mysql_version = mysql_get_server_info($this->db_connect_id);
|
||||
|
||||
if (version_compare($this->mysql_version, '4.1.3', '>='))
|
||||
@mysql_query("SET NAMES 'utf8'", $this->db_connect_id);
|
||||
// enforce strict mode on databases that support it
|
||||
if (version_compare(mysql_get_server_info($this->db_connect_id), '5.0.2', '>='))
|
||||
{
|
||||
@mysql_query("SET NAMES 'utf8'", $this->db_connect_id);
|
||||
// enforce strict mode on databases that support it
|
||||
if (version_compare($this->mysql_version, '5.0.2', '>='))
|
||||
$result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id);
|
||||
$row = @mysql_fetch_assoc($result);
|
||||
@mysql_free_result($result);
|
||||
$modes = array_map('trim', explode(',', $row['sql_mode']));
|
||||
|
||||
// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES
|
||||
if (!in_array('TRADITIONAL', $modes))
|
||||
{
|
||||
$result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id);
|
||||
$row = @mysql_fetch_assoc($result);
|
||||
@mysql_free_result($result);
|
||||
$modes = array_map('trim', explode(',', $row['sql_mode']));
|
||||
|
||||
// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES
|
||||
if (!in_array('TRADITIONAL', $modes))
|
||||
if (!in_array('STRICT_ALL_TABLES', $modes))
|
||||
{
|
||||
if (!in_array('STRICT_ALL_TABLES', $modes))
|
||||
{
|
||||
$modes[] = 'STRICT_ALL_TABLES';
|
||||
}
|
||||
|
||||
if (!in_array('STRICT_TRANS_TABLES', $modes))
|
||||
{
|
||||
$modes[] = 'STRICT_TRANS_TABLES';
|
||||
}
|
||||
$modes[] = 'STRICT_ALL_TABLES';
|
||||
}
|
||||
|
||||
$mode = implode(',', $modes);
|
||||
@mysql_query("SET SESSION sql_mode='{$mode}'", $this->db_connect_id);
|
||||
if (!in_array('STRICT_TRANS_TABLES', $modes))
|
||||
{
|
||||
$modes[] = 'STRICT_TRANS_TABLES';
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (version_compare($this->mysql_version, '4.0.0', '<'))
|
||||
{
|
||||
$this->sql_layer = 'mysql';
|
||||
|
||||
$mode = implode(',', $modes);
|
||||
@mysql_query("SET SESSION sql_mode='{$mode}'", $this->db_connect_id);
|
||||
}
|
||||
|
||||
return $this->db_connect_id;
|
||||
@@ -103,7 +88,7 @@ class dbal_mysql extends dbal
|
||||
*/
|
||||
function sql_server_info()
|
||||
{
|
||||
return 'MySQL ' . $this->mysql_version;
|
||||
return 'MySQL ' . mysql_get_server_info($this->db_connect_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,8 +20,9 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* MySQLi Database Abstraction Layer
|
||||
* mysqli-extension has to be compiled with:
|
||||
* MySQL 4.1+ or MySQL 5.0+
|
||||
* Compatible with:
|
||||
* MySQL 4.1+
|
||||
* MySQL 5.0+
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_mysqli extends dbal
|
||||
@@ -29,7 +30,7 @@ class dbal_mysqli extends dbal
|
||||
var $multi_insert = true;
|
||||
|
||||
// Supports multiple table deletion
|
||||
var $multi_table_deletion = false;
|
||||
var $multi_table_deletion = true;
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
|
@@ -1238,7 +1238,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
||||
case 'topic_approved':
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql4':
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||
SET t.topic_approved = p.post_approved
|
||||
@@ -2739,7 +2739,6 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limi
|
||||
|
||||
/**
|
||||
* Get database size
|
||||
* Currently only mysql and mssql are supported
|
||||
*/
|
||||
function get_database_size()
|
||||
{
|
||||
@@ -2751,7 +2750,6 @@ function get_database_size()
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
$sql = 'SELECT VERSION() AS mysql_version';
|
||||
$result = $db->sql_query($sql);
|
||||
|
@@ -44,7 +44,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
),
|
||||
'mysqli' => array(
|
||||
'LABEL' => 'MySQL with MySQLi Extension',
|
||||
'SCHEMA' => 'mysql_41',
|
||||
'SCHEMA' => 'mysql',
|
||||
'MODULE' => 'mysqli',
|
||||
'DELIM' => ';',
|
||||
'COMMENTS' => 'remove_remarks',
|
||||
@@ -194,7 +194,6 @@ function get_tables($db)
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
$sql = 'SHOW TABLES';
|
||||
break;
|
||||
@@ -346,6 +345,13 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed
|
||||
switch ($dbms_details['DRIVER'])
|
||||
{
|
||||
case 'mysql':
|
||||
if (version_compare(mysql_get_server_info($db->db_connect_id), '4.1.3', '<'))
|
||||
{
|
||||
$error[] = $lang['INST_ERR_DB_NO_MYSQL'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'mysqli':
|
||||
if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
|
||||
{
|
||||
@@ -432,11 +438,10 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
{
|
||||
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Kill the old table
|
||||
$db->sql_query('DROP TABLE ' . $final . ';');
|
||||
}
|
||||
|
||||
// Kill the old table
|
||||
$db->sql_query('DROP TABLE ' . $final . ';');
|
||||
|
||||
unset($final);
|
||||
}
|
||||
break;
|
||||
|
@@ -50,11 +50,6 @@ class fulltext_mysql extends search_backend
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
if ($db->sql_layer != 'mysql4' && $db->sql_layer != 'mysqli')
|
||||
{
|
||||
return $user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_VERSION'];
|
||||
}
|
||||
|
||||
$result = $db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\'');
|
||||
$info = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
@@ -628,27 +623,12 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
if (!isset($this->stats['post_subject']))
|
||||
{
|
||||
if ($db->sql_layer == 'mysqli' || version_compare($db->mysql_version, '4.1.3', '>='))
|
||||
{
|
||||
//$alter[] = 'MODIFY post_subject varchar(100) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alter[] = 'MODIFY post_subject text NOT NULL';
|
||||
}
|
||||
$alter[] = 'ADD FULLTEXT (post_subject)';
|
||||
}
|
||||
|
||||
if (!isset($this->stats['post_text']))
|
||||
{
|
||||
if ($db->sql_layer == 'mysqli' || version_compare($db->mysql_version, '4.1.3', '>='))
|
||||
{
|
||||
$alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alter[] = 'MODIFY post_text mediumtext NOT NULL';
|
||||
}
|
||||
$alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
|
||||
$alter[] = 'ADD FULLTEXT (post_text)';
|
||||
}
|
||||
|
||||
|
@@ -642,10 +642,8 @@ class fulltext_native extends search_backend
|
||||
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql4':
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
|
||||
// 3.x does not support SQL_CALC_FOUND_ROWS
|
||||
$sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT'];
|
||||
$is_mysql = true;
|
||||
|
||||
@@ -844,7 +842,7 @@ class fulltext_native extends search_backend
|
||||
{
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql4':
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
$select = 'SQL_CALC_FOUND_ROWS ' . $select;
|
||||
$is_mysql = true;
|
||||
|
@@ -1402,11 +1402,9 @@ class user extends session
|
||||
trigger_error('Could not get style data', E_USER_ERROR);
|
||||
}
|
||||
|
||||
// Now parse the cfg file and cache it
|
||||
$parsed_items = cache::obtain_cfg_items($this->theme);
|
||||
|
||||
// We are only interested in the theme configuration for now
|
||||
$parsed_items = $parsed_items['theme'];
|
||||
// Now parse the cfg file and cache it,
|
||||
// we are only interested in the theme configuration for now
|
||||
$parsed_items = cache::obtain_cfg_item($this->theme, 'theme');
|
||||
|
||||
$check_for = array(
|
||||
'parse_css_file' => (int) 0,
|
||||
|
Reference in New Issue
Block a user