/** * This is the new Update function, defined in 2.1.5 of the Core. It replaces the old __upgrade function. * * @param unknown_type $old_version_info the contents of the module record in the database. * @param unknown_type $new_version_info the contents of the module.php info file */ function export_manager__update($old_version_info, $new_version_info) { global $g_table_prefix; $old_version_date = date("Ymd", ft_convert_datetime_to_timestamp($old_version_info["module_date"])); if ($old_version_date < 20090908) { @mysql_query("ALTER TABLE {$g_table_prefix}module_export_groups TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_groups ENGINE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_group_clients TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_group_clients ENGINE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_types TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_types ENGINE=MyISAM"); } // added for 2.0.8 - it confirms that the previous update (which failed on some system) was made properly if ($old_version_date < 20111024) { $query = mysql_query("SHOW COLUMNS FROM {$g_table_prefix}module_export_groups"); $cols = array(); while ($row = mysql_fetch_assoc($query)) { $cols[] = $row["Field"]; } if (!in_array("form_view_mapping", $cols)) { $query = mysql_query("\n ALTER TABLE {$g_table_prefix}module_export_groups\n ADD form_view_mapping ENUM('all', 'except', 'only') NOT NULL\n DEFAULT 'all' AFTER access_type\n "); if (!$query) { return array(false, "We couldn't add the form_view_mapping database field. Please report this problem in the forums."); } } if (!in_array("forms_and_views", $cols)) { $query = mysql_query("\n ALTER TABLE {$g_table_prefix}module_export_groups\n ADD forms_and_views MEDIUMTEXT NULL AFTER form_view_mapping\n "); if (!$query) { return array(false, "We couldn't add the forms_and_views database field. Please report this problem in the forums."); } } } return array(true, ""); }
function core_field_types__update($old_version_info, $new_version_info) { global $g_table_prefix; $old_version_date = date("Ymd", ft_convert_datetime_to_timestamp($old_version_info["module_date"])); // fix for MAJOR issue where the raw field types weren't mapped to Option List settings. This was an issue from Oct - Nov 2011, for all // 2.1.5 - 2.1.8 versions installed during that time. if ($old_version_date < 20111122) { // dropdowns $select_field_type_id = ft_get_field_type_id_by_identifier("dropdown"); $field_info = ft_get_field_type($select_field_type_id, true); $option_list_setting_id = ""; foreach ($field_info["settings"] as $setting_info) { if ($setting_info["field_type"] == "option_list_or_form_field") { $option_list_setting_id = $setting_info["setting_id"]; break; } } if (!empty($option_list_setting_id)) { mysql_query("\n\t\t\t UPDATE {$g_table_prefix}field_types\n\t\t\t SET raw_field_type_map_multi_select_id = {$option_list_setting_id}\n\t\t\t WHERE field_type_id = {$select_field_type_id} AND\n\t\t\t raw_field_type_map_multi_select_id IS NULL\n\t\t\t LIMIT 1\n\t\t\t") or die(mysql_error()); } $multi_select_field_type_id = ft_get_field_type_id_by_identifier("multi_select_dropdown"); $field_info = ft_get_field_type($multi_select_field_type_id, true); $option_list_setting_id = ""; foreach ($field_info["settings"] as $setting_info) { if ($setting_info["field_type"] == "option_list_or_form_field") { $option_list_setting_id = $setting_info["setting_id"]; break; } } if (!empty($option_list_setting_id)) { mysql_query("\n\t\t\t UPDATE {$g_table_prefix}field_types\n\t\t\t SET raw_field_type_map_multi_select_id = {$option_list_setting_id}\n\t\t\t WHERE field_type_id = {$multi_select_field_type_id} AND\n\t\t\t raw_field_type_map_multi_select_id IS NULL\n\t\t\t LIMIT 1\n\t\t\t") or die(mysql_error()); } $radios_field_type_id = ft_get_field_type_id_by_identifier("radio_buttons"); $field_info = ft_get_field_type($radios_field_type_id, true); $option_list_setting_id = ""; foreach ($field_info["settings"] as $setting_info) { if ($setting_info["field_type"] == "option_list_or_form_field") { $option_list_setting_id = $setting_info["setting_id"]; break; } } if (!empty($option_list_setting_id)) { mysql_query("\n\t\t\t UPDATE {$g_table_prefix}field_types\n\t\t\t SET raw_field_type_map_multi_select_id = {$option_list_setting_id}\n\t\t\t WHERE field_type_id = {$radios_field_type_id} AND\n\t\t\t raw_field_type_map_multi_select_id IS NULL\n\t\t\t LIMIT 1\n\t\t\t") or die(mysql_error()); } $checkboxes_field_type_id = ft_get_field_type_id_by_identifier("checkboxes"); $field_info = ft_get_field_type($checkboxes_field_type_id, true); $option_list_setting_id = ""; foreach ($field_info["settings"] as $setting_info) { if ($setting_info["field_type"] == "option_list_or_form_field") { $option_list_setting_id = $setting_info["setting_id"]; break; } } if (!empty($option_list_setting_id)) { mysql_query("\n\t\t\t UPDATE {$g_table_prefix}field_types\n\t\t\t SET raw_field_type_map_multi_select_id = {$option_list_setting_id}\n\t\t\t WHERE field_type_id = {$checkboxes_field_type_id} AND\n\t\t\t raw_field_type_map_multi_select_id IS NULL\n\t\t\t LIMIT 1\n\t\t\t") or die(mysql_error()); } } return array(true, ""); }