Line 55 | Line 55 |
---|
'AVAILABLE' => true, '2.0.x' => false, ),
|
'AVAILABLE' => true, '2.0.x' => false, ),
|
| // Note: php 5.5 alpha 2 deprecated mysql. // Keep mysqli before mysql in this list.
|
'mysqli' => array( 'LABEL' => 'MySQL with MySQLi Extension', 'SCHEMA' => 'mysql_41',
| 'mysqli' => array( 'LABEL' => 'MySQL with MySQLi Extension', 'SCHEMA' => 'mysql_41',
|
Line 211 | Line 213 |
---|
/** * Get tables of a database
|
/** * Get tables of a database
|
| * * @deprecated
|
*/
|
*/
|
function get_tables($db)
| function get_tables(&$db)
|
{
|
{
|
switch ($db->sql_layer)
| if (!class_exists('phpbb_db_tools'))
|
{
|
{
|
case 'mysql': case 'mysql4': case 'mysqli': $sql = 'SHOW TABLES'; break;
case 'sqlite': $sql = 'SELECT name FROM sqlite_master WHERE type = "table"'; break;
case 'mssql': case 'mssql_odbc': case 'mssqlnative': $sql = "SELECT name FROM sysobjects WHERE type='U'"; break;
case 'postgres': $sql = 'SELECT relname FROM pg_stat_user_tables'; break;
case 'firebird': $sql = 'SELECT rdb$relation_name FROM rdb$relations WHERE rdb$view_source is null AND rdb$system_flag = 0'; break;
case 'oracle': $sql = 'SELECT table_name FROM USER_TABLES'; break;
| global $phpbb_root_path, $phpEx; require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);
|
}
|
}
|
$result = $db->sql_query($sql);
$tables = array();
while ($row = $db->sql_fetchrow($result)) { $tables[] = current($row); }
$db->sql_freeresult($result);
| $db_tools = new phpbb_db_tools($db);
|
|
|
return $tables;
| return $db_tools->sql_list_tables();
|
}
/**
| }
/**
|
Line 348 | Line 309 |
---|
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) { $db_error = $db->sql_error();
|
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) { $db_error = $db->sql_error();
|
$error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
| $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? utf8_convert_message($db_error['message']) : $lang['INST_ERR_DB_NO_ERROR']);
|
} else {
| } else {
|
Line 514 | Line 475 |
---|
}
/**
|
}
/**
|
* remove_remarks will strip the sql comment lines out of an uploaded sql file
| * Removes comments from schema files * * @deprecated Use phpbb_remove_comments() instead.
|
*/ function remove_remarks(&$sql) {
|
*/ function remove_remarks(&$sql) {
|
| // Remove # style comments
|
$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
|
$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
|
| // Return by reference }
/** * Removes "/* style" as well as "# style" comments from $input. * * @param string $input Input string * * @return string Input string with comments removed */ function phpbb_remove_comments($input) { if (!function_exists('remove_comments')) { global $phpbb_root_path, $phpEx; require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); }
// Remove /* */ comments remove_comments($input);
// Remove # style comments remove_remarks($input);
return $input;
|
}
/**
| }
/**
|
Line 554 | Line 544 |
---|
return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]); }
|
return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]); }
|
| }
/** * Creates the output to be stored in a phpBB config.php file * * @param array $data Array containing the database connection information * @param string $dbms The name of the DBAL class to use * @param array $load_extensions Array of additional extensions that should be loaded * @param bool $debug If the debug constants should be enabled by default or not * @param bool $debug_test If the DEBUG_TEST constant should be added * NOTE: Only for use within the testing framework * * @return string The output to write to the file */ function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug = false, $debug_test = false) { $load_extensions = implode(',', $load_extensions);
$config_data = "<?php\n"; $config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";
$config_data_array = array( 'dbms' => $dbms, 'dbhost' => $data['dbhost'], 'dbport' => $data['dbport'], 'dbname' => $data['dbname'], 'dbuser' => $data['dbuser'], 'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']), 'table_prefix' => $data['table_prefix'], 'acm_type' => 'file', 'load_extensions' => $load_extensions, );
foreach ($config_data_array as $key => $value) { $config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n"; }
$config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
if ($debug) { $config_data .= "@define('DEBUG', true);\n"; $config_data .= "@define('DEBUG_EXTRA', true);\n"; } else { $config_data .= "// @define('DEBUG', true);\n"; $config_data .= "// @define('DEBUG_EXTRA', true);\n"; }
if ($debug_test) { $config_data .= "@define('DEBUG_TEST', true);\n"; }
return $config_data;
|
}
?>
| }
?>
|