1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 07:07:51 +02:00

Bug #57265 - Convertors cannot read configuration files

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10473 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Josh Woody 2010-02-04 00:40:19 +00:00
parent 63be6762f3
commit 99c608e88c
3 changed files with 27 additions and 3 deletions

View File

@ -154,6 +154,7 @@
<li>[Fix] Do not store email templates in database. (Bug #54505)</li>
<li>[Fix] Fix javascript bug in the smilies ACP. (Bug #55725)</li>
<li>[Fix] Unify BBCode Selection across browsers. (Bug #38765)</li>
<li>[Fix] Allow convertors to read in configuration from files. (Bug #57265) (patch by Dicky)</li>
<li>[Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)</li>
<li>[Change] Log activation through inactive users ACP. (Bug #30145)</li>
<li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li>

View File

@ -1232,6 +1232,11 @@ function get_config()
$convert->p_master->error($user->lang['FILE_NOT_FOUND'] . ': ' . $filename, __LINE__, __FILE__);
}
if (isset($convert->config_schema['array_name']))
{
unset($convert->config_schema['array_name']);
}
$convert_config = extract_variables_from_file($filename);
if (!empty($convert->config_schema['array_name']))
{
@ -1264,6 +1269,7 @@ function restore_config($schema)
global $db, $config;
$convert_config = get_config();
foreach ($schema['settings'] as $config_name => $src)
{
if (preg_match('/(.*)\((.*)\)/', $src, $m))
@ -1274,8 +1280,16 @@ function restore_config($schema)
}
else
{
$config_value = (isset($convert_config[$src])) ? $convert_config[$src] : '';
}
if ($schema['table_format'] != 'file' || empty($schema['array_name']))
{
$config_value = (isset($convert_config[$src])) ? $convert_config[$src] : '';
}
else if (!empty($schema['array_name']))
{
$src_ary = $schema['array_name'];
$config_value = (isset($convert_config[$src_ary][$src])) ? $convert_config[$src_ary][$src] : '';
}
}
if ($config_value !== '')
{

View File

@ -32,7 +32,7 @@ unset($dbpasswd);
$convertor_data = array(
'forum_name' => 'phpBB 2.0.x',
'version' => '1.0.3',
'phpbb_version' => '3.0.6',
'phpbb_version' => '3.0.7',
'author' => '<a href="http://www.phpbb.com/">phpBB Group</a>',
'dbms' => $dbms,
'dbhost' => $dbhost,
@ -78,6 +78,15 @@ $tables = array(
*
* 'table_format' can take the value 'file' to indicate a config file. In this case array_name
* is set to indicate the name of the array the config values are stored in
* Example of using a file:
* $config_schema = array(
* 'table_format' => 'file',
* 'filename' => 'NAME OF FILE', // If the file is not in the root directory, the path needs to be added with no leading slash
* 'array_name' => 'NAME OF ARRAY', // Only used if the configuration file stores the setting in an array.
* 'settings' => array(
* 'board_email' => 'SUPPORT_EMAIL', // target config name => source target name
* )
* );
* 'table_format' can be an array if the values are stored in a table which is an assosciative array
* (as per phpBB 2.0.x)
* If left empty, values are assumed to be stored in a table where each config setting is