From e526dfe83e805e8ffac5abcab0ba2fc67c7563ce Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 17 Feb 2007 01:14:28 +0000 Subject: [PATCH] - only give DBAL options which were available in phpBB2 - default to phpBB3 DB config git-svn-id: file:///svn/phpbb/trunk@6996 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_install.php | 27 +++++++++++++++++--- phpBB/install/convertors/convert_phpbb20.php | 15 ++++++----- phpBB/install/install_convert.php | 4 +-- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 0b7bbb607f..0feaeff08e 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -27,7 +27,7 @@ function can_load_dll($dll) * Returns an array of available DBMS with some data, if a DBMS is specified it will only * return data for that DBMS and will load its extension if necessary. */ -function get_available_dbms($dbms = false, $return_unavailable = false) +function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false) { $available_dbms = array( 'firebird' => array( @@ -38,6 +38,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'firebird', 'AVAILABLE' => true, + '2.0.x' => false, ), 'mysqli' => array( 'LABEL' => 'MySQL with MySQLi Extension', @@ -47,6 +48,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'mysqli', 'AVAILABLE' => true, + '2.0.x' => true, ), 'mysql' => array( 'LABEL' => 'MySQL', @@ -56,6 +58,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'mysql', 'AVAILABLE' => true, + '2.0.x' => true, ), 'mssql' => array( 'LABEL' => 'MS SQL Server 2000+', @@ -65,6 +68,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_comments', 'DRIVER' => 'mssql', 'AVAILABLE' => true, + '2.0.x' => true, ), 'mssql_odbc'=> array( 'LABEL' => 'MS SQL Server [ ODBC ]', @@ -74,6 +78,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_comments', 'DRIVER' => 'mssql_odbc', 'AVAILABLE' => true, + '2.0.x' => true, ), 'oracle' => array( 'LABEL' => 'Oracle', @@ -83,6 +88,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_comments', 'DRIVER' => 'oracle', 'AVAILABLE' => true, + '2.0.x' => false, ), 'postgres' => array( 'LABEL' => 'PostgreSQL 7.x/8.x', @@ -92,6 +98,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_comments', 'DRIVER' => 'postgres', 'AVAILABLE' => true, + '2.0.x' => true, ), 'sqlite' => array( 'LABEL' => 'SQLite', @@ -101,6 +108,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false) 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'sqlite', 'AVAILABLE' => true, + '2.0.x' => false, ), ); @@ -119,6 +127,19 @@ function get_available_dbms($dbms = false, $return_unavailable = false) // now perform some checks whether they are really available foreach ($available_dbms as $db_name => $db_ary) { + if ($only_20x_options && !$db_ary['2.0.x']) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + continue; + } + $dll = $db_ary['MODULE']; if (!@extension_loaded($dll)) @@ -149,9 +170,9 @@ function get_available_dbms($dbms = false, $return_unavailable = false) /** * Generate the drop down of available database options */ -function dbms_select($default='') +function dbms_select($default = '', $only_20x_options = false) { - $available_dbms = get_available_dbms(); + $available_dbms = get_available_dbms(false, false, $only_20x_options); $dbms_options = ''; foreach ($available_dbms as $dbms_name => $details) { diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 4f66d3848a..8ba43f4be8 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -22,6 +22,9 @@ if (!defined('IN_PHPBB')) exit; } +include($phpbb_root_path . 'config.' . $phpEx); +unset($dbpasswd); + /** * $convertor_data provides some basic information about this convertor which is * used on the initial list of convertors and to populate the default settings @@ -31,12 +34,12 @@ $convertor_data = array( 'version' => '0.9', 'phpbb_version' => '3.0.0', 'author' => 'phpBB Group', - 'dbms' => 'mysql', - 'dbhost' => 'localhost', - 'dbport' => '', - 'dbuser' => 'user', - 'dbpasswd' => 'password', - 'dbname' => '', + 'dbms' => $dbms, + 'dbhost' => $dbhost, + 'dbport' => $dbport, + 'dbuser' => $dbuser, + 'dbpasswd' => '', + 'dbname' => $dbname, 'table_prefix' => 'phpbb_', 'forum_path' => '../forums', 'author_notes' => 'Avatars may be on a different width/height than with the old forum. This is due to dimensions being stored within phpBB3 but not within phpBB2. The default dimension was set to 80x80 for avatars where dimension settings could not be determined. You might wish to instruct your users to check their profiles after the conversion to ensure that the size is correct.', diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index a3541f6f29..862964fccd 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -397,7 +397,7 @@ class install_convert extends module } $connect_test = false; - $available_dbms = get_available_dbms(false, true); + $available_dbms = get_available_dbms(false, true, true); if (!isset($available_dbms[$src_dbms]) || !$available_dbms[$src_dbms]['AVAILABLE']) { @@ -2110,7 +2110,7 @@ class install_convert extends module */ var $convert_options = array( 'legend1' => 'SPECIFY_OPTIONS', - 'src_dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false), + 'src_dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\', true)', 'explain' => false), 'src_dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true), 'src_dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true), 'src_dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false),