1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[feature/remove-imagesets] Changing database structure

Removing imagesets. Changing database structure

PHPBB3-10336
This commit is contained in:
Vjacheslav Trushkin
2011-09-03 18:55:30 +03:00
parent 929c13a52b
commit 33adfd633b
12 changed files with 20 additions and 460 deletions

View File

@@ -1742,72 +1742,6 @@ class install_install extends module
$error = $db->sql_error($db->sql_error_sql);
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
}
$valid_localized = array(
'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply',
);
$sql_ary = array();
$sql = 'SELECT *
FROM ' . STYLES_IMAGESET_TABLE;
$result = $db->sql_query($sql);
while ($imageset_row = $db->sql_fetchrow($result))
{
if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg"))
{
$cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg");
foreach ($cfg_data_imageset_data as $image_name => $value)
{
if (strpos($value, '*') !== false)
{
if (substr($value, -1, 1) === '*')
{
list($image_filename, $image_height) = explode('*', $value);
$image_width = 0;
}
else
{
list($image_filename, $image_height, $image_width) = explode('*', $value);
}
}
else
{
$image_filename = $value;
$image_height = $image_width = 0;
}
if (strpos($image_name, 'img_') === 0 && $image_filename)
{
$image_name = substr($image_name, 4);
if (in_array($image_name, $valid_localized))
{
$sql_ary[] = array(
'image_name' => (string) $image_name,
'image_filename' => (string) $image_filename,
'image_height' => (int) $image_height,
'image_width' => (int) $image_width,
'imageset_id' => (int) $imageset_row['imageset_id'],
'image_lang' => (string) $lang_pack['lang_iso'],
);
}
}
}
}
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
if ($db->sql_error_triggered)
{
$error = $db->sql_error($db->sql_error_sql);
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
}
}
}
}
closedir($dir);