diff options
author | Nils Adermann <naderman@naderman.de> | 2012-04-21 12:31:43 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2012-04-21 12:31:43 +0200 |
commit | cdf7ff17974eb20f37b25998036a723ea783a381 (patch) | |
tree | cb6fe83f4907aa71f62564438b845be587082b63 /phpBB | |
parent | 29a6aec9ad312bb11e19295f0b8d44efbc86d933 (diff) | |
parent | 6293bbf09949335bb8101bcef8f043750d756dc9 (diff) | |
download | forums-cdf7ff17974eb20f37b25998036a723ea783a381.tar forums-cdf7ff17974eb20f37b25998036a723ea783a381.tar.gz forums-cdf7ff17974eb20f37b25998036a723ea783a381.tar.bz2 forums-cdf7ff17974eb20f37b25998036a723ea783a381.tar.xz forums-cdf7ff17974eb20f37b25998036a723ea783a381.zip |
Merge remote-tracking branch 'github-noxwizard/ticket/10492' into develop-olympus
* github-noxwizard/ticket/10492:
[ticket/10492] Fix line endings
[ticket/10492] Backporting functional tests
[ticket/10492] Separate config generation from the installer
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions_install.php | 52 | ||||
-rw-r--r-- | phpBB/install/install_install.php | 28 |
2 files changed, 53 insertions, 27 deletions
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 6caa5c943f..633b2755f0 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -512,4 +512,56 @@ function adjust_language_keys_callback($matches) } } +/** +* 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 +* +* @return string The output to write to the file +*/ +function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug = 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"; + } + + $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! + + return $config_data; +} + ?>
\ No newline at end of file diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 454c8b4df0..81dac9ecde 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -884,34 +884,8 @@ class install_install extends module @chmod($phpbb_root_path . 'cache/install_lock', 0777); - $load_extensions = implode(',', $load_extensions); - // Time to convert the data provided into a config file - $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' => $available_dbms[$data['dbms']]['DRIVER'], - '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"; - } - unset($config_data_array); - - $config_data .= "\n@define('PHPBB_INSTALLED', true);\n"; - $config_data .= "// @define('DEBUG', true);\n"; - $config_data .= "// @define('DEBUG_EXTRA', true);\n"; - $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! + $config_data = phpbb_create_config_file_data($data, $available_dbms[$data['dbms']]['DRIVER'], $load_extensions); // Attempt to write out the config file directly. If it works, this is the easiest way to do it ... if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) || phpbb_is_writable($phpbb_root_path)) |