mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[feature/functional-tests] Generate config correctly and install only once
PHPBB3-10414
This commit is contained in:
@@ -104,7 +104,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'DRIVER' => 'mssqlnative',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
),
|
||||
'oracle' => array(
|
||||
'LABEL' => 'Oracle',
|
||||
'SCHEMA' => 'oracle',
|
||||
@@ -555,3 +555,45 @@ function adjust_language_keys_callback($matches)
|
||||
return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@@ -876,33 +876,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 = 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))
|
||||
|
Reference in New Issue
Block a user