mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 12:28:52 +00:00
[ticket/11015] Move db driver class name fixing to function
PHPBB3-11015
This commit is contained in:
parent
8f8a7f7637
commit
5bc0f4b3d4
7 changed files with 33 additions and 35 deletions
|
@ -44,7 +44,7 @@ class phpbb_di_extension_config extends Extension
|
||||||
|
|
||||||
$container->setParameter('core.table_prefix', $table_prefix);
|
$container->setParameter('core.table_prefix', $table_prefix);
|
||||||
$container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
|
$container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
|
||||||
$container->setParameter('dbal.driver.class', $this->convert_30_dbms($dbms));
|
$container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms));
|
||||||
$container->setParameter('dbal.dbhost', $dbhost);
|
$container->setParameter('dbal.dbhost', $dbhost);
|
||||||
$container->setParameter('dbal.dbuser', $dbuser);
|
$container->setParameter('dbal.dbuser', $dbuser);
|
||||||
$container->setParameter('dbal.dbpasswd', $dbpasswd);
|
$container->setParameter('dbal.dbpasswd', $dbpasswd);
|
||||||
|
@ -80,20 +80,4 @@ class phpbb_di_extension_config extends Extension
|
||||||
|
|
||||||
return $acm_type;
|
return $acm_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert 3.0 dbms to 3.1 db driver class name
|
|
||||||
*
|
|
||||||
* @param string $dbms dbms parameter
|
|
||||||
* @return db driver class
|
|
||||||
*/
|
|
||||||
protected function convert_30_dbms($dbms)
|
|
||||||
{
|
|
||||||
if (!preg_match('#^phpbb_db_driver_#', $dbms))
|
|
||||||
{
|
|
||||||
return 'phpbb_db_driver_'.$dbms;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $dbms;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5412,3 +5412,19 @@ function phpbb_to_numeric($input)
|
||||||
{
|
{
|
||||||
return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
|
return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert 3.0 dbms to 3.1 db driver class name
|
||||||
|
*
|
||||||
|
* @param string $dbms dbms parameter
|
||||||
|
* @return db driver class
|
||||||
|
*/
|
||||||
|
function phpbb_convert_30_dbms_to_31($dbms)
|
||||||
|
{
|
||||||
|
if (!preg_match('#^phpbb_db_driver_#', $dbms))
|
||||||
|
{
|
||||||
|
return 'phpbb_db_driver_'.$dbms;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dbms;
|
||||||
|
}
|
||||||
|
|
|
@ -260,6 +260,8 @@ class phpbb_questionnaire_phpbb_data_provider
|
||||||
include("{$phpbb_root_path}config.$phpEx");
|
include("{$phpbb_root_path}config.$phpEx");
|
||||||
unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
|
unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
|
||||||
|
|
||||||
|
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||||
|
|
||||||
// Only send certain config vars
|
// Only send certain config vars
|
||||||
$config_vars = array(
|
$config_vars = array(
|
||||||
'active_sessions' => true,
|
'active_sessions' => true,
|
||||||
|
|
|
@ -24,6 +24,8 @@ if (!defined('IN_PHPBB'))
|
||||||
include($phpbb_root_path . 'config.' . $phpEx);
|
include($phpbb_root_path . 'config.' . $phpEx);
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
|
||||||
|
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $convertor_data provides some basic information about this convertor which is
|
* $convertor_data provides some basic information about this convertor which is
|
||||||
* used on the initial list of convertors and to populate the default settings
|
* used on the initial list of convertors and to populate the default settings
|
||||||
|
|
|
@ -123,6 +123,8 @@ class install_convert extends module
|
||||||
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
||||||
|
|
||||||
|
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||||
|
|
||||||
$db = new $dbms();
|
$db = new $dbms();
|
||||||
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
@ -210,6 +212,8 @@ class install_convert extends module
|
||||||
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
||||||
|
|
||||||
|
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||||
|
|
||||||
$db = new $dbms();
|
$db = new $dbms();
|
||||||
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
@ -332,6 +336,8 @@ class install_convert extends module
|
||||||
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
||||||
|
|
||||||
|
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||||
|
|
||||||
$db = new $dbms();
|
$db = new $dbms();
|
||||||
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
@ -573,6 +579,8 @@ class install_convert extends module
|
||||||
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
|
||||||
|
|
||||||
|
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||||
|
|
||||||
$db = new $dbms();
|
$db = new $dbms();
|
||||||
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
|
|
@ -91,6 +91,8 @@ class install_update extends module
|
||||||
define('MERGE_NEW_FILE', 3);
|
define('MERGE_NEW_FILE', 3);
|
||||||
define('MERGE_MOD_FILE', 4);
|
define('MERGE_MOD_FILE', 4);
|
||||||
|
|
||||||
|
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||||
|
|
||||||
$db = new $dbms();
|
$db = new $dbms();
|
||||||
|
|
||||||
// Connect to DB
|
// Connect to DB
|
||||||
|
|
|
@ -78,7 +78,7 @@ class phpbb_test_case_helpers
|
||||||
include($test_config);
|
include($test_config);
|
||||||
|
|
||||||
$config = array_merge($config, array(
|
$config = array_merge($config, array(
|
||||||
'dbms' => $this->convert_30_dbms($dbms),
|
'dbms' => phpbb_convert_30_dbms_to_31($dbms),
|
||||||
'dbhost' => $dbhost,
|
'dbhost' => $dbhost,
|
||||||
'dbport' => $dbport,
|
'dbport' => $dbport,
|
||||||
'dbname' => $dbname,
|
'dbname' => $dbname,
|
||||||
|
@ -96,7 +96,7 @@ class phpbb_test_case_helpers
|
||||||
if (isset($_SERVER['PHPBB_TEST_DBMS']))
|
if (isset($_SERVER['PHPBB_TEST_DBMS']))
|
||||||
{
|
{
|
||||||
$config = array_merge($config, array(
|
$config = array_merge($config, array(
|
||||||
'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $this->convert_30_dbms($_SERVER['PHPBB_TEST_DBMS']) : '',
|
'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? phpbb_convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '',
|
||||||
'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '',
|
'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '',
|
||||||
'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '',
|
'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '',
|
||||||
'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '',
|
'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '',
|
||||||
|
@ -223,20 +223,4 @@ class phpbb_test_case_helpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert 3.0 dbms to 3.1 db driver class name
|
|
||||||
*
|
|
||||||
* @param string $dbms dbms parameter
|
|
||||||
* @return db driver class
|
|
||||||
*/
|
|
||||||
protected function convert_30_dbms($dbms)
|
|
||||||
{
|
|
||||||
if (!preg_match('#^phpbb_db_driver_#', $dbms))
|
|
||||||
{
|
|
||||||
return 'phpbb_db_driver_'.$dbms;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $dbms;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue