mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 08:17:47 +02:00
[ticket/10492] Separate config generation from the installer
PHPBB3-10492
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user