diff options
author | Nils Adermann <naderman@naderman.de> | 2011-10-14 17:10:21 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-10-14 17:23:31 +0200 |
commit | a3928bf82d7fd6a1da074716c08c547afc961346 (patch) | |
tree | 0ad5cd4b50869cf6d8100324cf2cc49751b98bac /phpBB/includes/functions_install.php | |
parent | 0ffe494edd274647ba6694648dba070c63e55d89 (diff) | |
download | forums-a3928bf82d7fd6a1da074716c08c547afc961346.tar forums-a3928bf82d7fd6a1da074716c08c547afc961346.tar.gz forums-a3928bf82d7fd6a1da074716c08c547afc961346.tar.bz2 forums-a3928bf82d7fd6a1da074716c08c547afc961346.tar.xz forums-a3928bf82d7fd6a1da074716c08c547afc961346.zip |
[feature/functional-tests] Generate config correctly and install only once
PHPBB3-10414
Diffstat (limited to 'phpBB/includes/functions_install.php')
-rw-r--r-- | phpBB/includes/functions_install.php | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 4746b2f6e1..7742bb9263 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -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; +} |