diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-06-29 21:58:17 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-07-07 01:02:40 +0200 |
commit | ed812a9dfb59b1eb83263adbaa52723ff826a791 (patch) | |
tree | c75d2136fa2486fb994dbddb8b7fa88401237e44 /phpBB/includes | |
parent | 98e8be966bd8174c2a3f4e8fb80167b23573441f (diff) | |
download | forums-ed812a9dfb59b1eb83263adbaa52723ff826a791.tar forums-ed812a9dfb59b1eb83263adbaa52723ff826a791.tar.gz forums-ed812a9dfb59b1eb83263adbaa52723ff826a791.tar.bz2 forums-ed812a9dfb59b1eb83263adbaa52723ff826a791.tar.xz forums-ed812a9dfb59b1eb83263adbaa52723ff826a791.zip |
[ticket/12775] Move phpbb_convert_30_dbms_to_31 into the config file class
PHPBB3-12775
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 46 | ||||
-rw-r--r-- | phpBB/includes/questionnaire/questionnaire.php | 7 |
2 files changed, 5 insertions, 48 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9d5770069d..158bf1cbc0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5327,52 +5327,6 @@ function phpbb_to_numeric($input) } /** -* Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name. -* -* If $dbms is a valid 3.1 db driver class name, returns it unchanged. -* Otherwise prepends phpbb\db\driver\ to the dbms to convert a 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) -{ - // Note: this check is done first because mysqli extension - // supplies a mysqli class, and class_exists($dbms) would return - // true for mysqli class. - // However, per the docblock any valid 3.1 driver name should be - // recognized by this function, and have priority over 3.0 dbms. - if (strpos($dbms, 'phpbb\db\driver') === false && class_exists('phpbb\db\driver\\' . $dbms)) - { - return 'phpbb\db\driver\\' . $dbms; - } - - if (class_exists($dbms)) - { - // Additionally we could check that $dbms extends phpbb\db\driver\driver. - // http://php.net/manual/en/class.reflectionclass.php - // Beware of possible performance issues: - // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance - // We could check for interface implementation in all paths or - // only when we do not prepend phpbb\db\driver\. - - /* - $reflection = new \ReflectionClass($dbms); - - if ($reflection->isSubclassOf('phpbb\db\driver\driver')) - { - return $dbms; - } - */ - - return $dbms; - } - - throw new \RuntimeException("You have specified an invalid dbms driver: $dbms"); -} - -/** * Get the board contact details (e.g. for emails) * * @param \phpbb\config\config $config diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index b4b01a74bf..302419618e 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -258,10 +258,13 @@ class phpbb_questionnaire_phpbb_data_provider function get_data() { global $phpbb_root_path, $phpEx; - include("{$phpbb_root_path}config.$phpEx"); + + $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); + $phpbb_config_php_file->set_config_file($phpbb_root_path . 'config.' . $phpEx); + extract($phpbb_config_php_file->get_all()); unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution - $dbms = phpbb_convert_30_dbms_to_31($dbms); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); // Only send certain config vars $config_vars = array( |