diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-10-25 12:09:09 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-10-25 12:09:09 +0200 |
commit | e9f4be9052c3f3874a79c1b68934fc6b256491f1 (patch) | |
tree | 5bb3bdc415b52ab9fed97bcab9b7cf8260da8fb7 /phpBB/install | |
parent | 881ad935d55dd69876f9c5aee1a9d100242fbbaa (diff) | |
download | forums-e9f4be9052c3f3874a79c1b68934fc6b256491f1.tar forums-e9f4be9052c3f3874a79c1b68934fc6b256491f1.tar.gz forums-e9f4be9052c3f3874a79c1b68934fc6b256491f1.tar.bz2 forums-e9f4be9052c3f3874a79c1b68934fc6b256491f1.tar.xz forums-e9f4be9052c3f3874a79c1b68934fc6b256491f1.zip |
[ticket/11031] Update extension group names after converting them
PHPBB3-11031
Diffstat (limited to 'phpBB/install')
-rw-r--r-- | phpBB/install/convertors/convert_phpbb20.php | 3 | ||||
-rw-r--r-- | phpBB/install/convertors/functions_phpbb20.php | 48 |
2 files changed, 51 insertions, 0 deletions
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index e8f8a2033f..a6dced8d7d 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -341,6 +341,9 @@ if (!$get_info) update_folder_pm_count(); ', ' update_unread_count(); + ', (defined('MOD_ATTACHMENT')) ? ' + phpbb_attachment_extension_group_name(); + ' : ' ', ' phpbb_convert_authentication(\'start\'); ', ' diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 136ca991ae..4cb9237daf 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -1415,6 +1415,54 @@ function phpbb_attachment_category($cat_id) } /** +* Convert the attachment extension names +* This is only used if the Attachment MOD was installed +*/ +function phpbb_attachment_extension_group_name() +{ + global $db, $phpbb_root_path, $phpEx; + + // Update file extension group names to use language strings. + $sql = 'SELECT lang_dir + FROM ' . LANG_TABLE; + $result = $db->sql_query($sql); + + $extension_groups_updated = array(); + while ($lang_dir = $db->sql_fetchfield('lang_dir')) + { + $lang_dir = basename($lang_dir); + + if (!file_exists($phpbb_root_path . 'language/' . $lang_dir . '/acp/attachments.' . $phpEx)) + { + continue; + } + + $lang = array(); + include($lang_file); + + foreach ($lang as $lang_key => $lang_val) + { + if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0) + { + continue; + } + + $sql_ary = array( + 'group_name' => substr($lang_key, 10), // Strip off 'EXT_GROUP_' + ); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE group_name = '" . $db->sql_escape($lang_val) . "'"; + $db->sql_query($sql); + + $extension_groups_updated[$lang_key] = true; + } + } + $db->sql_freeresult($result); +} + +/** * Obtain list of forums in which different attachment categories can be used */ function phpbb_attachment_forum_perms($forum_permissions) |