include "lib.database"; include "lib.snapon"; subroutine(convert_v7_profile(string v7_profile_pathname, string v8profilename, string v8databasedirectory), ( #echo("convert_v7_profile()"); # This converts a v7 profile to a v8 profile #echo("v7_profile_pathname: " . v7_profile_pathname); # Read the v7 profile string v7_profile_string = read_file(v7_profile_pathname); # Read the v7 profile into a node #string v7_profile_local_pathname = internal.LOGANALYSISINFO_DIRECTORY . internal.directory_divider . "TemporaryFiles" . internal.directory_divider . "converted_v7_profile.cfg"; #echo("v7_profile_local_pathname: " . v7_profile_local_pathname); #write_file(v7_profile_local_pathname, v7_profile_string); #node v7profile = 'TemporaryFiles.converted_v7_profile'; node v7profile = string_to_node(v7_profile_string); string v7profilename = node_name(v7profile); #v7profilename = v7profilename; # Get the name of the v7 profile #string v7profilename = volatile.v7profilename; # Compute the name of the converted profile # 2009-01-30 - GMF - At Karl's request, this is now a parameter if (v8profilename eq "") then v8profilename = v7profilename; #string v8profilename = v7profilename; # Get the node for the v7 profile #node v7profile = 'v7profiles.' . v7profilename; # Copy the v7 profile to v8profilename in profiles. delete_node('profiles.' . v8profilename); clone_node(v7profile, 'profiles.' . v8profilename); node v8profile = 'profiles'{v8profilename}; # 2009-04-01 - GMF - Changed type to "int" (it was string, which caused errors when displaying Individual Sessions). # It really should be "int" -- ssession_id field does not use itemnums. #v.session_fields.ssession_id.type = "int"; #v.session_fields.ssession_id.aggregation_method = "none"; #v.session_fields.ssession_id.display_format_type = "string"; #v.session_fields.ssession_id.default_in_reports = false; # #v.session_fields.ssessions.type = "unique"; #v.session_fields.ssessions.aggregation_method = "unique"; #v.session_fields.ssessions.display_format_type = "integer"; #v.session_fields.ssessions.source_database_field = "ssession_id"; #v.session_fields.ssessions.default_in_reports = true; # #v.session_fields.ssession_events.type = "int"; #v.session_fields.ssession_events.aggregation_method = "sum"; #v.session_fields.ssession_events.display_format_type = "integer"; #v.session_fields.ssession_events.default_in_reports = true; # #v.session_fields.ssession_user.type = "string"; #v.session_fields.ssession_user.aggregation_method = "none"; #v.session_fields.ssession_user.display_format_type = "string"; #v.session_fields.ssession_user.default_in_reports = false; # #v.session_fields.ssession_users.type = "unique"; #v.session_fields.ssession_users.aggregation_method = "unique"; #v.session_fields.ssession_users.display_format_type = "integer"; #v.session_fields.ssession_users.default_in_reports = true; # #v.session_fields.ssession_date_time.type = "string"; #v.session_fields.ssession_date_time.aggregation_method = "none"; #v.session_fields.ssession_date_time.display_format_type = "date_time"; #v.session_fields.ssession_date_time.default_in_reports = false; # #v.session_fields.ssession_begin.type = "int"; #v.session_fields.ssession_begin.aggregation_method = "min"; #v.session_fields.ssession_begin.display_format_type = "date_time"; #v.session_fields.ssession_begin.source_database_field = "ssession_date_time"; #v.session_fields.ssession_begin.default_in_reports = true; # #v.session_fields.ssession_end.type = "int"; #v.session_fields.ssession_end.aggregation_method = "max"; #v.session_fields.ssession_end.display_format_type = "date_time"; #v.session_fields.ssession_end.source_database_field = "ssession_date_time"; #v.session_fields.ssession_end.default_in_reports = true; # #v.session_fields.ssession_duration.type = "int"; #v.session_fields.ssession_duration.aggregation_method = "sum"; #v.session_fields.ssession_duration.display_format_type = "duration_compact"; #v.session_fields.ssession_duration.default_in_reports = true; # #v.session_fields.ssession_page.type = "string"; #v.session_fields.ssession_page.aggregation_method = "none"; #v.session_fields.ssession_page.display_format_type = "page"; #v.session_fields.ssession_page.default_in_reports = false; # ## 2009-06-17 - GMF - Changed aggregation_method to sum--this field sums to show total session events ## 2009-07-31 - GMF - Changed type to int and display_format_type to integer--this is an int field (not a string) #v.session_fields.ssession_event.type = "int"; #v.session_fields.ssession_event.aggregation_method = "sum"; #v.session_fields.ssession_users.display_format_type = "integer"; #v.session_fields.ssession_event.default_in_reports = false; # ## 2009-06-17 - GMF - Changed aggregation_method to sum--this field sums to show total entry pages ## 2009-07-31 - GMF - Changed type to int and display_format_type to integer--this is an int field (not a string) #v.session_fields.ssession_entrances.type = "int"; #v.session_fields.ssession_entrances.aggregation_method = "sum"; #v.session_fields.ssession_users.display_format_type = "integer"; #v.session_fields.ssession_entrances.default_in_reports = true; # ## 2009-06-17 - GMF - Changed aggregation_method to sum--this field sums to show total exit pages ## 2009-07-31 - GMF - Changed type to int and display_format_type to integer--this is an int field (not a string) #v.session_fields.ssession_exits.type = "int"; #v.session_fields.ssession_exits.aggregation_method = "sum"; #v.session_fields.ssession_users.display_format_type = "integer"; #v.session_fields.ssession_exits.default_in_reports = true; # Remember that this is a converted profile v8profile{"create_profile_wizard_info"}{"converted_from_v7_profile"} = true; ## ## CONVERT DATABASE OPTIONS ## # Get the options nodes node v7_database_options = v7profile{"database"}{"options"}; node v8_database_options = v8profile{"database"}{"options"}; node v8_database_options_server = v8_database_options{"server"}; # Convert the database type if (@v7_database_options{"database_type"} eq "internal") then @v8_database_options_server{"type"} = "internal_sql"; else if (@v7_database_options{"database_type"} eq "mysql") then @v8_database_options_server{"type"} = "mysql"; else error("Unknown database type: '" . @v7_database_options{"database_type"} . "' in v7-to-v8 profile conversion"); # 2008-11-28 - GMF - If sql_database_name is specified on the command line, use it as the v8 database name if (command_line.sql_database_name ne '') then @v8_database_options_server{"database_name"} = command_line.sql_database_name; else @v8_database_options_server{"database_name"} = @v7_database_options{"mysql_database_name"}; # Copy the other options @v8_database_options_server{"dsn"} = @v7_database_options{"mysql_server_hostname"}; @v8_database_options_server{"hostname"} = @v7_database_options{"mysql_server_hostname"}; @v8_database_options_server{"username"} = @v7_database_options{"mysql_server_username"}; @v8_database_options_server{"password"} = @v7_database_options{"mysql_server_password"}; @v8_database_options_server{"socket"} = @v7_database_options{"mysql_server_socket"}; # Delete options from their v7 locations delete_node(v8_database_options{"database_type"}); delete_node(v8_database_options{"mysql_database_name"}); delete_node(v8_database_options{"mysql_server_hostname"}); delete_node(v8_database_options{"mysql_server_username"}); delete_node(v8_database_options{"mysql_server_password"}); delete_node(v8_database_options{"mysql_server_socket"}); #echo("Done converting database options"); ## ## CONVERT DATABASE TUNING ## node database_tuning = v8profile{"database"}{"tuning"}; # Set defaults for options which did not exist in v7 @database_tuning{"keep_itemnums_in_memory"} = false; @database_tuning{"itemnums_cache_size"} = "10M"; @database_tuning{"xref_tables_cache_size"} = 88888; @database_tuning{"update_xrefs_on_update"} = true; # Set defaults for options which did not exist in v7 @database_tuning{"split_queries"}{"method"} = "none"; @database_tuning{"split_queries"}{"number_of_threads"} = "2"; #echo("Done converting database tuning"); ## ## CONVERT STATISTICS MISCELLANEOUS ## node statistics_miscellaneous = v8profile{"statistics"}{"miscellaneous"}; # Set default profile-wide global filters to empty @statistics_miscellaneous{"date_filter"}{"df"} = ""; @statistics_miscellaneous{"filter"}{"expression"} = ""; @statistics_miscellaneous{"filter"}{"comment"} = ""; # Turn on the Calendar by default, as a report @statistics_miscellaneous{"enable_calendar_in_reports_menu"} = true; @statistics_miscellaneous{"show_calendar_as_default_report"} = false; @statistics_miscellaneous{"show_hide_menus_affect_all_views"} = true; # Correct buggy v7 profiles which had 0 as first_weekday or marked_weekday if (@statistics_miscellaneous{"first_weekday"} eq "0") then @statistics_miscellaneous{"first_weekday"} = 1; if (@statistics_miscellaneous{"marked_weekday"} eq "0") then @statistics_miscellaneous{"marked_weekday"} = 1; #echo("Done converting statistics.miscellaneous"); ## ## CONVERT OUTPUT ## node output = v8profile{"output"}; # Set defaults for options which did not exist in v7 @output{"number_decimal_divider"} = ""; #echo("Done converting output"); ## ## CONVERT LOG PROCESSING ## node log_processing = v8profile{"log"}{"processing"}; # Set defaults for options which did not exist in v7 @log_processing{"real_time"} = false; @log_processing{"distributed"}{"method"} = "auto"; @log_processing{"distributed"}{"starting_port_auto"} = 9987; #echo("Done converting log.processing"); ## ## CROSS REFERENCE GROUPS ## node cross_reference_groups = v8profile{"database"}{"cross_reference_groups"}; node field_options = v8profile{"log"}{"field_options"}; bool sessions_exist = true; #echo('@field_options{"sessions_event_field"}: ' . @field_options{"sessions_event_field"}); #echo('field_options: ' . node_as_string(field_options)); if ((@field_options{"sessions_visitor_id_field"} eq "none") or (@field_options{"sessions_event_field"} eq "none") or (@field_options{"sessions_page_field"} eq "none")) then sessions_exist = false; node database_fields = v8profile{"database"}{"fields"}; # If there is no database field corresponding to the sessions_event_field, sessions are not available. if (!(database_fields?{@field_options{"sessions_event_field"}})) then ( # echo("No database field " . @field_options{"sessions_event_field"} . ' => no sessions'); sessions_exist = false; ); #echo("sessions_exist: " . sessions_exist); node cross_reference_group; foreach cross_reference_group cross_reference_groups ( # Add all numerical session fields to this xref group # if (sessions_exist) then ( # node session_field; # foreach session_field 'v.session_fields' ( # if (@session_field{"default_in_reports"}) then # @cross_reference_group{node_name(session_field)} = "";# # ); # ); # Get the name of this xref group string name = node_name(cross_reference_group); # v7 xref groups contain only field names, just like the "fields" section of v8 xref groups. # So rename the v7 xref group to "fields", so we can use it as the "fields" section in the converted group. rename_node(cross_reference_group, 'fields'); # Create the v8 group @cross_reference_groups{name} = ""; # Move the "fields" node into the group insert_node(cross_reference_groups{name}, cross_reference_group, 1); # Give the group a label @cross_reference_groups{name}{"label"} = name; ); # for each xref ## ## CONVERT LOG FIELDS ## node log_fields = v8profile{"log"}{"fields"}; node log_field; string page_field_name; string host_field_name; string referrer_field_name; foreach log_field log_fields ( string log_field_name = node_name(log_field); # Convert the label to use capitalize/expand if (matches_regular_expression(@log_field{"label"}, '^[$]lang_stats[.]field_labels[.]([a-z0-9_]+)$')) then @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.' . $1 . '))=}'; # Get the field names for the standard field types if (@log_field{"type"} eq "page") then ( # 2012-07-13 - GMF - Handle case where page field exists in log fields, but not database fields. [ThreadID:1272186] if (database_fields?{log_field_name}) then page_field_name = log_field_name; ); if (@log_field{"type"} eq "referrer") then referrer_field_name = log_field_name; if (@log_field{"type"} eq "URL") then referrer_field_name = log_field_name; if (@log_field{"type"} eq "host") then host_field_name = log_field_name; # If the log field has no type, set it to "flat" -- v7 allowed empty type, but v8 doesn't. if (@log_field{"type"} eq "") then @log_field{"type"} = "flat"; if (@log_field{"label"} eq "") then @log_field{"label"} = node_name(log_field); if (log_field?{"derived_from_1"}) then delete_node(log_field{"derived_from_1"}); ); # foreach log_fields # If there is no database field corresponding to the sessions_visitor_id_field, sessions are not available. #if (!(database_fields?{@field_options{"sessions_visitor_id_field"}})) then ( # echo("No database field " . @field_options{"sessions_visitor_id_field"} . ' => no sessions'); # sessions_exist = false; #); #echo("sessions_exist: " . sessions_exist); #if (sessions_exist) then ( # # Create the session fields #node session_field; #foreach session_field 'v.session_fields' ( # # string session_field_name = node_name(session_field); # # log_field = log_fields{session_field_name}; # @log_field{"index"} = 0; # @log_field{"subindex"} = 0; # @log_field{"type"} = "flat"; # @log_field{"derived_from_1"} = session_field_name; # # # 2008-11-07 - GMF - Changed all the field_labels.session* values to field_label.ssession*, because that's what they're actually called in field_labels. # # if (session_field_name eq "ssessions") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssessions))=' . '}'; # else if (session_field_name eq "ssession_events") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssession_events))=' . '}'; # else if (session_field_name eq "ssession_user") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.user))=' . '}' # else if (session_field_name eq "ssession_users") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssession_users))=' . '}' # else if (session_field_name eq "ssession_date_time") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.date_time))=' . '}'; # else if (session_field_name eq "ssession_begin") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssession_begin))=' . '}'; # else if (session_field_name eq "ssession_end") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssession_end))=' . '}'; # else if (session_field_name eq "ssession_duration") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssession_duration))=' . '}'; # else if (session_field_name eq "ssession_page") then ## @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.page))=' . '}'; # else if (session_field_name eq "ssession_id") then # @log_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.ssession_id))=" . "}"; # else if (session_field_name eq "ssession_event") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.event))=' . '}' # else if (session_field_name eq "ssession_entrances") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssession_entrances))=' . '}' # else if (session_field_name eq "ssession_exits") then # @log_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.ssession_exits))=' . '}' # else # @log_field{"label"} = ""; # #); # foreach session_field # #); # if sessions exist #echo("Done converting log.filters"); ## ## CONVERT DATABASE FIELDS ## # Create a report_fields node node report_fields = v8profile{"statistics"}{"report_fields"}; node database_field; string entries_field_name; foreach database_field database_fields ( # echo("database_field: " . node_as_string(database_field)); string database_field_name = node_name(database_field); # Remember the entries field name if (database_field?{"entries_field"}) then entries_field_name = database_field_name; # If this is the date_time field, split it into year, month, day. if (database_field_name eq "date_time") then ( # Create a report field for this database field node date_time_timestamp_report_field = report_fields{"date_time_timestamp"}; @date_time_timestamp_report_field{"display_format_type"} = "date_time"; @date_time_timestamp_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.date_time_timestamp))=" . "}"; @date_time_timestamp_report_field{"column_label"} = "{=capitalize(expand(lang_stats.field_labels.date_time))=" . "}"; @date_time_timestamp_report_field{"column_info"} = ""; @date_time_timestamp_report_field{"database_field"} = "date_time"; # 2008-12-08 - GMF - Changed -2 to -1 -- what does -2 mean as subitems_level? The C++ doesn't know about -2, and gives an error. # 2009-06-03 - GMF - After discussion with Karl, -2 means "source item field" which is a non-itemnum field straight from the data. Timestamp is like that, so -2 it is. @date_time_timestamp_report_field{"subitems_level"} = -2; # Create a report field for this database field node year_report_field = report_fields{"year"}; @year_report_field{"display_format_type"} = "date_time"; @year_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.year))=" . "}"; @year_report_field{"column_label"} = ""; @year_report_field{"column_info"} = ""; @year_report_field{"database_field"} = "date_time"; @year_report_field{"subitems_level"} = 1; node month_report_field = report_fields{"month"}; @month_report_field{"display_format_type"} = "date_time"; @month_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.month))=" . "}"; @month_report_field{"column_label"} = ""; @month_report_field{"column_info"} = ""; @month_report_field{"database_field"} = "date_time"; @month_report_field{"subitems_level"} = 2; node day_report_field = report_fields{"day"}; @day_report_field{"display_format_type"} = "date_time"; @day_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.day))=" . "}"; @day_report_field{"column_label"} = ""; @day_report_field{"column_info"} = ""; @day_report_field{"database_field"} = "date_time"; @day_report_field{"subitems_level"} = 3; # Create the date_time field for log_detail node date_time_report_field = report_fields{"date_time"}; @date_time_report_field{"display_format_type"} = "date_time"; @date_time_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.date_time))=" . "}"; @date_time_report_field{"column_label"} = ""; @date_time_report_field{"column_info"} = ""; @date_time_report_field{"database_field"} = "date_time"; # 2008-12-08 - GMF - Changed -2 to -1 -- what does -2 mean as subitems_level? The C++ doesn't know about -2, and gives an error. # 2009-06-03 - GMF - After discussion with Karl, -2 means "source item field" which is a non-itemnum field straight from the data. Timestamp is like that, so -2 it is. # But the "date_time" field of log detail is not that--it is an itemnum field, not the timestamp field. And in log detail, it should show # bottom-level items (days). So, changing this to -1. @date_time_report_field{"subitems_level"} = -1; delete_node(database_field{"display_format_type"}); ); # if date_time # If this is the location field, split it into country, region, and city else if (database_field_name eq "location") then ( # Create a report field for this database field node country_report_field = report_fields{"country"}; @country_report_field{"type"} = "string"; @country_report_field{"display_format_type"} = "string"; @country_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.country))=" . "}"; @country_report_field{"column_label"} = ""; @country_report_field{"column_info"} = ""; @country_report_field{"database_field"} = "location"; @country_report_field{"subitems_level"} = 1; node region_report_field = report_fields{"region"}; @region_report_field{"type"} = "string"; @region_report_field{"display_format_type"} = "string"; @region_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.region))=" . "}"; @region_report_field{"column_label"} = ""; @region_report_field{"column_info"} = ""; @region_report_field{"database_field"} = "location"; @region_report_field{"subitems_level"} = 2; node city_report_field = report_fields{"city"}; @city_report_field{"type"} = "string"; @city_report_field{"display_format_type"} = "string"; @city_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.city))=" . "}"; @city_report_field{"column_label"} = ""; @city_report_field{"column_info"} = ""; @city_report_field{"database_field"} = "location"; @city_report_field{"subitems_level"} = 3; # Create the location field for log_detail node location_report_field = report_fields{"location"}; @location_report_field{"type"} = "string"; @location_report_field{"display_format_type"} = "location"; @location_report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.location))=" . "}"; @location_report_field{"column_label"} = ""; @location_report_field{"column_info"} = ""; @location_report_field{"database_field"} = "location"; # 2008-12-08 - GMF - Changed -2 to -1 -- what does -2 mean as subitems_level? The C++ doesn't know about -2, and gives an error. # 2009-06-03 - GMF - After discussion with Karl, -2 means "source item field" which is a non-itemnum field straight from the data. # But the "location" field of log detail is not that--it is an itemnum field. Changing this to -1. @location_report_field{"subitems_level"} = -1; delete_node(database_field{"display_format_type"}); ); # if location else if (!database_field?{"type"}) then ( # echo("Ignoring untyped database field: " . node_as_string(database_field)); ); # Otherwise, create a report field for this database field. else ( # Create a report field for this database field node report_field = report_fields{database_field_name}; # Move the display format type value to the report field if (database_field?{"display_format_type"}) then @report_field{"display_format_type"} = @database_field{"display_format_type"}; else @report_field{"display_format_type"} = "string"; # Move the type to the report field # Profile wizard uses "int" as type for visitors; doing that here. # SUSPECT: v8 bug? # @report_field{"type"} = @database_field{"type"}; # if (@report_field{"type"} eq "unique") then # @report_field{"type"} = "int"; # Use special types for some fields # if (database_field_name eq "day_of_week") then # @report_field{"type"} = "day_of_week"; # if (database_field_name eq "hour_of_day") then # @report_field{"type"} = "hour_of_day"; @report_field{"field_type"} = "database_field"; # Move the label to the report field if (node_exists("lang_stats.field_labels." . database_field_name)) then @report_field{"label"} = "{=capitalize(expand(lang_stats.field_labels." . database_field_name . "))=" . "}"; else @report_field{"label"} = @database_field{"label"}; # Set column_label and column_info. @report_field{"column_label"} = ""; @report_field{"column_info"} = ""; # Set the database_field @report_field{"database_field"} = database_field_name; # Compute subitems_level if (database_field_name eq page_field_name) then @report_field{"subitems_level"} = -1; else if (database_field_name eq host_field_name) then @report_field{"subitems_level"} = -1; else if (database_field_name eq referrer_field_name) then @report_field{"subitems_level"} = -1; else if (database_field_name eq 'web_browser') then @report_field{"subitems_level"} = -1; else if (database_field_name eq 'page_directory') then @report_field{"subitems_level"} = 0; # Don't use a display_format_type for day_of_week or hour_of_day if ((database_field_name eq "day_of_week") or (database_field_name eq "hour_of_day")) then delete_node(database_field{"display_format_type"}); ); # single field # Convert the label to use capitalize/expand if (matches_regular_expression(@database_field{"label"}, '^[$]lang_stats[.]field_labels[.]([a-z0-9_]+)$')) then @database_field{"label"} = '{=capitalize(expand(lang_stats.field_labels.' . $1 . '))=}'; # Set category if (database_field_name eq 'date_time') then @database_field{"category"} = "date_time"; else if (database_field_name eq 'day_of_week') then @database_field{"category"} = "day_of_week"; else if (database_field_name eq 'hour_of_day') then @database_field{"category"} = "hour_of_day"; else @database_field{"category"} = ""; # Use "page" as display_format_type for the page field. if (database_field_name eq page_field_name) then ( @database_field{"display_format_type"} = "page"; ); # Compute the aggregation method from the type if (@database_field{"type"} eq "int") then ( @database_field{"aggregation_method"} = "sum"; ); else if (@database_field{"type"} eq "float") then ( @database_field{"aggregation_method"} = "sum"; ); else if (@database_field{"type"} eq "unique") then ( @database_field{"aggregation_method"} = "unique"; ); else @database_field{"aggregation_method"} = "none"; # In v7, day_of_week and hour_of_day is "string" type, but in v8 it's "int", so change it. if ((database_field_name eq 'day_of_week') or (database_field_name eq 'hour_of_day')) then @database_field{"type"} = "int"; ); # foreach database_fields # Don't create the session fields when converting to 8.5; we'll create them by attaching a sessions snapon #node session_field; #if (sessions_exist) then ( # ## Create the session fields #foreach session_field 'v.session_fields' ( # # string session_field_name = node_name(session_field); # # # 2009-07-13 - GMF - Commented out ssession_entrances and ssession_exits (to make them be in the database fields list)-- # # these are in a default profile--why were they excluded here? They're not excluded from the xrefs list, # # so excluding them here causes an error. # if (session_field_name ne "ssession_event") then ( ## (session_field_name ne "ssession_entrances") and ## (session_field_name ne "ssession_exits")) then ( # # # Create the session database fields # @database_fields{session_field_name}{"category"} = "session_field"; # @database_fields{session_field_name}{"label"} = "{=" . "capitalize(expand(lang_stats.field_labels." . session_field_name . "))=" . "}"; # @database_fields{session_field_name}{"suppress_top"} = 0; # @database_fields{session_field_name}{"suppress_bottom"} = 2; # # # overlay_node(session_field, database_fields{session_field_name}); # # node parameter; # foreach parameter session_field ( # @database_fields{session_field_name}{node_name(parameter)} = @parameter; # ); # # # Create the session report field # # SUSPECT: Bug in v8? Why is ssessions an "int" field, instead of "unique"? Many other types look wrong here too. # @report_fields{session_field_name}{"database_field"} = session_field_name; # # if (session_field_name eq "ssessions") then # @report_fields{session_field_name}{"type"} = "int"; # else if (session_field_name eq "ssession_users") then # @report_fields{session_field_name}{"type"} = "int"; # else if (session_field_name eq "ssession_begin") then # @report_fields{session_field_name}{"type"} = "string"; # else if (session_field_name eq "ssession_end") then # @report_fields{session_field_name}{"type"} = "string"; # else if (session_field_name eq "ssession_duration") then # @report_fields{session_field_name}{"type"} = "string"; # else # @report_fields{session_field_name}{"type"} = @session_field{"type"}; # # @report_fields{session_field_name}{"label"} = @database_fields{session_field_name}{"label"}; # # # 2008-11-14 - GMF - Turned these off, because they change the names from what they would be in v8, to something else. # # For instance, session_begin, which appears as "Session begin" in a new v8 profile, will appear as "Start time" # # in a converted v7 profile. "Session begin" is the more accurate label, so why do we need another? # # This difference of labels was reported as a bug against v8 (bz826), and this fixes it. ## if (session_field_name eq "ssessions") then ## @report_fields{session_field_name}{"column_label"} = '{=capitalize(expand(lang_stats.field_labels.ssessions))=' . '}'; ## else if (session_field_name eq "ssession_events") then ## @report_fields{session_field_name}{"column_label"} = '{=capitalize(expand(lang_stats.field_labels.events))=' . '}'; ## else if (session_field_name eq "ssession_user") then ## @report_fields{session_field_name}{"column_label"} = '{=capitalize(expand(lang_stats.field_labels.user))=' . '}' ## else if (session_field_name eq "ssession_begin") then ## @report_fields{session_field_name}{"column_label"} = '{=capitalize(expand(lang_stats.field_labels.start_time))=' . '}'; ## else if (session_field_name eq "ssession_end") then ## @report_fields{session_field_name}{"column_label"} = '{=capitalize(expand(lang_stats.field_labels.end_time))=' . '}'; ## else if (session_field_name eq "ssession_duration") then ## @report_fields{session_field_name}{"column_label"} = '{=capitalize(expand(lang_stats.field_labels.time_spent))=' . '}'; ## else if (session_field_name eq "ssession_page") then ## @report_fields{session_field_name}{"column_label"} = '{=capitalize(expand(lang_stats.field_labels.page))=' . '}'; ## else # @report_fields{session_field_name}{"column_label"} = ""; # # # 2008-11-14 - GMF - Added session_field value to the database field for ssession_begin and ssession_end. # # Without this, the Overview shows these fields as integers (because is_date_time_in_epoc is set from this value). # # 2009-05-06 - GMF - Also turned off all the show_ values, because that's how they are in a new profile (and individual sessions shouldn't aggregate these fields). # if (session_field_name eq "ssession_begin") then ( # @database_fields{session_field_name}{"session_field"} = "session_begin"; # @database_fields{session_field_name}{"derivation_method"} = "session_field"; # @report_fields{session_field_name}{"show_remainder_value"} = false; # @report_fields{session_field_name}{"show_average_value"} = false; # @report_fields{session_field_name}{"show_min_value"} = false; # @report_fields{session_field_name}{"show_max_value"} = false; # @report_fields{session_field_name}{"show_total_value"} = false; # ); # else if (session_field_name eq "ssession_end") then ( # @database_fields{session_field_name}{"session_field"} = "session_end"; # @database_fields{session_field_name}{"derivation_method"} = "session_field"; # @report_fields{session_field_name}{"show_remainder_value"} = false; # @report_fields{session_field_name}{"show_average_value"} = false; # @report_fields{session_field_name}{"show_min_value"} = false; # @report_fields{session_field_name}{"show_max_value"} = false; # @report_fields{session_field_name}{"show_total_value"} = false; # ); # # @report_fields{session_field_name}{"column_info"} = ""; # @report_fields{session_field_name}{"display_format_type"} = @database_fields{session_field_name}{"display_format_type"}; # # ); # if session database field # #); # foreach session_field # #); # if sessions exist #echo("page_field_name: " . page_field_name); # Add the page_directory field. string page_directory_field_name = page_field_name . "_directory"; node page_directory_field = report_fields{page_directory_field_name}; page_directory_field{"database_field"} = page_field_name; @page_directory_field{"type"} = "string"; @page_directory_field{"display_format_type"} = "page"; @page_directory_field{"label"} = "{=capitalize(expand(lang_stats.field_labels.page)) . '/' . lang_stats.miscellaneous.directory=" . "}"; @page_directory_field{"column_label"} = ""; @page_directory_field{"column_info"} = ""; @page_directory_field{"subitems_level"} = 0; #echo("Done converting database.fields"); ## ## CONVERT DATABASE SERVER ## node database_server = v8profile{"database"}{"options"}{"server"}; #echo("v8databasedirectory: " . v8databasedirectory); if (length(v8databasedirectory) > 0) then @database_server{"database_directory"} = v8databasedirectory; else @database_server{"database_directory"} = @v8profile{"database"}{"options"}{"database_directory"}; #echo('@database_server{"database_directory"}: ' . @database_server{"database_directory"}); #echo("Done converting database.server"); ## ## CONVERT GRAPH COLOR SCHEME TYPES # e.g. # graph_color_scheme_types = { # chronological_bar_graph = "numerical" # chronological_line_graph = "numerical" # bar_graph = "numerical" # line_graph = "numerical" # table_bar_graph = "single" # } # graph_color_scheme_types node graph_color_scheme_types = v8profile{"statistics"}{"graph_color_scheme_types"}; @graph_color_scheme_types{"chronological_bar_graph"} = "numerical"; @graph_color_scheme_types{"chronological_line_graph"} = "numerical"; @graph_color_scheme_types{"bar_graph"} = "numerical"; @graph_color_scheme_types{"line_graph"} = "numerical"; @graph_color_scheme_types{"table_bar_graph"} = "single"; ## ## CREATE STATISTICS.GRAPHS # e.g. # graphs = { # show_3d_pie_chart = "false" # color_schemes = { # chrono_bar_graph = "numerical" # chrono_line_graph = "numerical" # bar_graph = "numerical" # line_graph = "numerical" # table_bar_graph = "single" # } # color_schemes # } # graphs node statistics_graphs = v8profile{"statistics"}{"graphs"}; @statistics_graphs{"show_3d_pie_chart"} = false; @statistics_graphs{"color_schemes"}{"chrono_bar_graph"} = "numerical"; @statistics_graphs{"color_schemes"}{"chrono_line_graph"} = "numerical"; @statistics_graphs{"color_schemes"}{"bar_graph"} = "numerical"; @statistics_graphs{"color_schemes"}{"line_graph"} = "numerical"; @statistics_graphs{"color_schemes"}{"table_bar_graph"} = "single"; ## ## CONVERT REPORTS ## # Create a report_fields node node reports = v8profile{"statistics"}{"reports"}; #node report; #echo("hello"); #echo("reports: " . node_as_string(reports)); for (int reportnum = 0; reportnum < num_subnodes(reports); reportnum++) ( #foreach report reports ( node report = subnode_by_number(reports, reportnum); string report_name = node_name(report); # echo("reportnum: " . reportnum . "\n"); # If this is a bottom-level items report, rename it to new convention. if (matches_regular_expression(report_name, '^([a-z0-9_]+)_bottom_level_items')) then ( string bottom_level_report_element_name = node_name(reports{($1 . "_bottom_level_items")}{"report_elements"}[0]); string hierarchical_report_element_name = node_name(reports{$1}{"report_elements"}[0]); #echo("report_element_name: " . report_element_name); rename_node(reports{$1}{"report_elements"}{hierarchical_report_element_name}, $1 . "_directory"); rename_node(reports{$1}, $1 . "_directory"); rename_node(reports{($1 . "_bottom_level_items")}{"report_elements"}{bottom_level_report_element_name}, $1); rename_node(reports{($1 . "_bottom_level_items")}, $1); @reports{($1 . "_directory")}{"report_elements"}{($1 . "_directory")}{"report_field"} = $1 . "_directory"; @reports{($1 . "_directory")}{"report_elements"}{($1 . "_directory")}{"columns"}{0}{"report_field"} = $1 . "_directory"; # delete_node(report); ## reportnum--; report = subnode_by_number(reports, reportnum); #echo("Converted report: " . node_as_string(reports{$1})); ); # If this is date_time report, change it to year, month, and day reports. if (report_name eq "date_time") then ( # 2009-03-16 - GMF - Get the name of the first report element (probably the only report element), so we can rename it below. string report_element_name = node_name(subnode_by_number(report{"report_elements"}, 0)); # echo("report_element_name: " . report_element_name); node year_report = clone_node(report); rename_node(year_report, "year"); @year_report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.year)))=' . '}'; rename_node(year_report{"report_elements"}{report_element_name}, "year"); @year_report{"report_elements"}{"year"}{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.year)))=' . '}'; @year_report{"report_elements"}{"year"}{"database_field_name"} = "year"; @year_report{"report_elements"}{"year"}{"sort_by"} = "year"; @year_report{"report_elements"}{"year"}{"columns"}{0}{"field_name"} = "year"; insert_node(reports, year_report, reportnum); node month_report = clone_node(report); rename_node(month_report, "month"); @month_report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.month)))=' . '}'; rename_node(month_report{"report_elements"}{report_element_name}, "month"); @month_report{"report_elements"}{"month"}{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.month)))=' . '}'; @month_report{"report_elements"}{"month"}{"database_field_name"} = "month"; @month_report{"report_elements"}{"month"}{"sort_by"} = "month"; @month_report{"report_elements"}{"month"}{"columns"}{0}{"field_name"} = "month"; insert_node(reports, month_report, reportnum); #echo("month_report: " . node_as_string(month_report)); node day_report = clone_node(report); rename_node(day_report, "day"); @day_report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.day)))=' . '}'; rename_node(day_report{"report_elements"}{report_element_name}, "day"); @day_report{"report_elements"}{"day"}{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.day)))=' . '}'; @day_report{"report_elements"}{"day"}{"database_field_name"} = "day"; @day_report{"report_elements"}{"day"}{"sort_by"} = "day"; @day_report{"report_elements"}{"day"}{"columns"}{0}{"field_name"} = "day"; insert_node(reports, day_report, reportnum); delete_node(report); reportnum--; ); # if date_time report # If this is the location report, change it to country, region, and city. if (report_name eq "location") then ( node country_report = clone_node(report); rename_node(country_report, "country"); node country_report_element = country_report{"report_elements"}[0]; @country_report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.country)))=' . '}'; rename_node(country_report_element, "country"); @country_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.country)))=' . '}'; @country_report_element{"database_field_name"} = "country"; @country_report_element{"report_field"} = "country"; @country_report_element{"sort_by"} = "hits"; @country_report_element{"columns"}{0}{"field_name"} = "country"; insert_node(reports, country_report, reportnum); node region_report = clone_node(report); rename_node(region_report, "region"); node region_report_element = region_report{"report_elements"}[0]; @region_report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.region)))=' . '}'; rename_node(region_report_element, "region"); @region_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.region)))=' . '}'; @region_report_element{"database_field_name"} = "region"; @region_report_element{"report_field"} = "region"; @region_report_element{"sort_by"} = "hits"; @region_report_element{"columns"}{0}{"field_name"} = "region"; insert_node(reports, region_report, reportnum); node city_report = clone_node(report); rename_node(city_report, "city"); node city_report_element = city_report{"report_elements"}[0]; @city_report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.city)))=' . '}'; rename_node(city_report_element, "city"); @city_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.city)))=' . '}'; @city_report_element{"database_field_name"} = "city"; @city_report_element{"report_field"} = "city"; @city_report_element{"sort_by"} = "hits"; @city_report_element{"columns"}{0}{"field_name"} = "city"; insert_node(reports, city_report, reportnum); delete_node(report); reportnum--; ); # if location report # The days report no longer exists; delete it. else if (report_name eq "days") then ( delete_node(report); reportnum--; ); # The location report no longer exists; delete it. else if (report_name eq "location") then ( delete_node(report); reportnum--; ); # else if ((report_element_type eq "exit_pages") or # (report_element_type eq "entry_pages") or # (report_element_type eq "session_pages") or # (report_element_type eq "session_users") or # (report_element_type eq "individual_sessions")) then ( else if ((report_name eq "exit_pages") or (report_name eq "entry_pages") or (report_name eq "session_pages") or (report_name eq "session_users") or (report_name eq "session_page_paths") or (report_name eq "session_paths") or (report_name eq "sessions_overview") or (report_name eq "individual_sessions")) then ( delete_node(report); #echo("Deleting session report: " . report_name); reportnum--; ); # If we're not deleting this report, touch it up. else ( # Convert label from '{=capitalize(pluralize(print(database.fields.day_of_week.label)))= }' to # '{=capitalize(pluralize(expand(lang_stats.field_labels.day_of_week)))= }' if (matches_regular_expression(@report{"label"}, '^[{]=capitalize[(]pluralize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)]=[}]$')) then ( if (subnode_exists('lang_stats.field_labels', $1)) then @report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $1 . ')))=' . '}'; else @report{"label"} = $1; ); # Convert label from '{=capitalize(pluralize(print(database.fields.page.label))) . '/' . lang_stats.miscellaneous.directories;= }' to # '{=capitalize(pluralize(expand(lang_stats.field_labels.day_of_week)))= }' if (matches_regular_expression(@report{"label"}, `^[{]=capitalize[(]pluralize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)] . '/' . lang_stats.miscellaneous.directories;=[}]$`)) then ( if (subnode_exists('lang_stats.field_labels', $1)) then @report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $1 . '))) . \'/\' . lang_stats.miscellaneous.directories=' . '}'; else @report{"label"} = $1; ); # Convert label from '{=capitalize(pluralize(expand(database.fields.page.label))) . '/' . lang_stats.miscellaneous.directories;= }' to # '{=capitalize(pluralize(expand(lang_stats.field_labels.page))) . '/' . lang_stats.miscellaneous.directories= }' if (matches_regular_expression(@report{"label"}, `^[{]=capitalize[(]pluralize[(]expand[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)] . '/' . lang_stats.miscellaneous.directories;=[}]$`)) then ( if (subnode_exists('lang_stats.field_labels', $1)) then @report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $1 . '))) . '/' . lang_stats.miscellaneous.directories=' . '}'; else @report{"label"} = $1; ); # Convert label from '{=pluralize(capitalize(print(database.fields.day_of_week.label)));= }' to # '{=capitalize(pluralize(expand(lang_stats.field_labels.day_of_week)))= }' #echo("LABEL: '" . @report{"label"} . "'"); if (matches_regular_expression(@report{"label"}, '^[{]=pluralize[(]capitalize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)];=[}]$')) then ( #echo("MATCH R"); if (subnode_exists('lang_stats.field_labels', $1)) then @report{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $1 . ')))=' . '}'; else @report{"label"} = $1; #echo("Changed label of " . report . " to: " . @report{"label"}); ); if (matches_regular_expression(@report{"label"}, `^[{]=capitalize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)] . lang_stats.multi_column_report_divider . database[.]fields[.]([a-z0-9_]+)[.]label=[}]$`)) then ( @report{"label"} = '$lang_stats.menu.reports.search_phrase_by_search_engine'; ); # Touch up the report elements node report_elements = report{"report_elements"}; # foreach report_element report_elements ( for (int report_element_num = 0; report_element_num < num_subnodes(report_elements); report_element_num++) ( node report_element = subnode_by_number(report_elements, report_element_num); string report_element_name = node_name(report_element); if ((report_element_name eq "exit_pages") or (report_element_name eq "entry_pages") or (report_element_name eq "session_pages") or (report_element_name eq "session_users") or (report_element_name eq "session_page_paths") or (report_element_name eq "session_paths") or (report_element_name eq "sessions_overview") or (report_element_name eq "individual_sessions")) then ( delete_node(report_element); #echo("Deleting session report element: " . report_element_name); report_element_num--; ); else ( #echo("report_element_name: " . report_element_name); # Convert the date_time report element to year/month/day report elements if (report_element_name eq "date_time") then ( node year_report_element = clone_node(report_element); rename_node(year_report_element, "year"); @year_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.year)))=' . '}'; @year_report_element{"database_field_name"} = 'year'; @year_report_element{"columns"}{"0"}{"field_name"} = "year"; @year_report_element{"sort_by"} = 'year'; insert_node(report_elements, year_report_element, report_element_num); node month_report_element = clone_node(report_element); rename_node(month_report_element, "month"); @month_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.month)))=' . '}'; @month_report_element{"database_field_name"} = 'month'; @month_report_element{"columns"}{"0"}{"field_name"} = "month"; @month_report_element{"sort_by"} = 'month'; insert_node(report_elements, month_report_element, report_element_num + 1); node day_report_element = clone_node(report_element); rename_node(day_report_element, "day"); @day_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.day)))=' . '}'; @day_report_element{"database_field_name"} = 'day'; @day_report_element{"columns"}{"0"}{"field_name"} = "day"; @day_report_element{"sort_by"} = 'day'; insert_node(report_elements, day_report_element, report_element_num + 2); delete_node(report_element); report_element_num--; ); # if date_time # If this is a bottom-level items report, rename it and its sibling to the new convention. if (matches_regular_expression(report_element_name, '^([a-z0-9_]+)_bottom_level_items')) then ( #echo("Renaming " . report_elements{$1} . " to " . $1 . "_directory"); rename_node(report_elements{$1}, $1 . "_directory"); rename_node(report_elements{($1 . "_bottom_level_items")}, $1); @report_elements{($1 . "_directory")}{"report_field"} = $1 . "_directory"; @report_elements{($1 . "_directory")}{"columns"}{0}{"report_field"} = $1 . "_directory"; # report_element_num--; ); # The days report no longer exists; delete it. if (report_element_name eq "days") then ( delete_node(report_element); report_element_num--; ); # The location report no longer exists; delete it. else if (report_element_name eq "location") then ( node country_report_element = clone_node(report_element); rename_node(country_report_element, "country"); @country_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.country)))=' . '}'; @country_report_element{"database_field_name"} = 'country'; @country_report_element{"columns"}{"0"}{"field_name"} = "country"; # @country_report_element{"sort_by"} = 'country'; insert_node(report_elements, country_report_element, report_element_num); node region_report_element = clone_node(report_element); rename_node(region_report_element, "region"); @region_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.region)))=' . '}'; @region_report_element{"database_field_name"} = 'region'; @region_report_element{"columns"}{"0"}{"field_name"} = "region"; # @region_report_element{"sort_by"} = 'region'; insert_node(report_elements, region_report_element, report_element_num + 1); node city_report_element = clone_node(report_element); rename_node(city_report_element, "city"); @city_report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.city)))=' . '}'; @city_report_element{"database_field_name"} = 'city'; @city_report_element{"columns"}{"0"}{"field_name"} = "city"; # @city_report_element{"sort_by"} = 'city'; insert_node(report_elements, city_report_element, report_element_num + 2); delete_node(report_element); report_element_num--; ); # if location else ( string report_element_type = @report_element{"type"}; # 2009-01-14 - GMF - Some v7 profiles have no sessions, but have session reports. Skip these. if (!sessions_exist) then ( # echo("report_element_type=" . report_element_type); if ((report_element_type eq "entry_pages") or (report_element_type eq "session_pages") or (report_element_type eq "session_users") or (report_element_type eq "individual_sessions") or (report_element_type eq "exit_pages")) then ( # echo("Found report element " . report_element_type . ", but no sessions!"); last; ); ); # if !sessions_exist # Convert label from '{=capitalize(pluralize(print(database.fields.day_of_week.label)))= }' to # '{=capitalize(pluralize(expand(lang_stats.field_labels.day_of_week)))= }' if (matches_regular_expression(@report_element{"label"}, '^[{]=capitalize[(]pluralize[(](print|expand)[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)]=[}]$')) then ( if (subnode_exists('lang_stats.field_labels', $2)) then @report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $2 . ')))=' . '}'; else @report_element{"label"} = $2; ); # Convert label from '{=pluralize(capitalize(print(database.fields.day_of_week.label)));= }' to # '{=capitalize(pluralize(expand(lang_stats.field_labels.day_of_week)))= }' if (matches_regular_expression(@report_element{"label"}, '^[{]=pluralize[(]capitalize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)];=[}]$')) then ( if (subnode_exists('lang_stats.field_labels', $1)) then @report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $1 . ')))=' . '}'; else @report_element{"label"} = $1; ); # Convert label from '{=capitalize(pluralize(print(database.fields.page.label))) . '/' . lang_stats.miscellaneous.directories;= }' to # '{=capitalize(pluralize(expand(lang_stats.field_labels.page))) . '/' . lang_stats.miscellaneous.directories= }' if (matches_regular_expression(@report_element{"label"}, `^[{]=capitalize[(]pluralize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)] . '/' . lang_stats.miscellaneous.directories;=[}]$`)) then ( if (subnode_exists('lang_stats.field_labels', $1)) then @report_element{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $1 . '))) . \'/\' . lang_stats.miscellaneous.directories=' . '}'; else @report_element{"label"} = $1; ); # Convert label from '{=capitalize(expand(database.fields.search_phrase.label)) . lang_stats.multi_column_report_divider . database.fields.search_engine.label= }' to # '$lang_stats.menu.reports.search_phrase_by_search_engine' if (matches_regular_expression(@report_element{"label"}, `^[{]=capitalize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)] . lang_stats.multi_column_report_divider . database[.]fields[.]([a-z0-9_]+)[.]label=[}]$`)) then ( if (subnode_exists('lang_stats.field_labels', $1)) then @report_element{"label"} = '$lang_stats.menu.reports.search_phrase_by_search_engine'; else @report_element{"label"} = $1; ); # Convert "print()" references in the label to "expand()" if (matches_regular_expression(@report_element{"label"}, '^(.*)[(]print[(](.*)$')) then ( @report_element{"label"} = $1 . "(expand(" . $2; ); #echo("NOW label of " . report_element . " is " . @report_element{"label"}); # If there is database_field_name, rename it to "report_field" if (report_element?{"database_field_name"}) then # delete_node(report_element{"database_field_name"}); rename_node(report_element{"database_field_name"}, "report_field"); # There is no show_omitted_items_row in v8 profiles; remove it. if (report_element?{"show_omitted_items_row"}) then rename_node(report_element{"show_omitted_items_row"}, "show_remainder_row"); # There is no show_header_bar in v8 profiles in the Overview; remove it. # SUSPECT: Bug in v8? if (report_element?{"show_header_bar"} and (@report_element{"type"} eq "overview")) then delete_node(report_element{"show_header_bar"}); # starting_row and ending_row are implemented using number_of_rows in v8, so convert them. if (report_element?{"starting_row"}) then ( int number_of_rows = @report_element{"ending_row"} - @report_element{"starting_row"}; if (report_element_name ne "log_detail") then number_of_rows++; @report_element{"number_of_rows"} = number_of_rows; delete_node(report_element{"starting_row"}); delete_node(report_element{"ending_row"}); ); # There is no only_bottom_level_items in v8 profiles; remove it. if (report_element?{"only_bottom_level_items"}) then delete_node(report_element{"only_bottom_level_items"}); # If this is the broken_links report, and sort_by is "", that's because of a bug in v7. Fix it. if ((report_element_name eq "broken_links") and (@report_element{"sort_by"} eq "")) then ( @report_element{"sort_by"} = "hits"; ); # If this is the log_detail, v8 uses "" as the sort direction. if ((report_element_name eq "log_detail") and report_element?{"sort_direction"}) then ( @report_element{"sort_direction"} = ""; ); # Change sort_by=sessions to sort_by=ssessions if (report_element?{"sort_by"} and (@report_element{"sort_by"} eq "sessions")) then ( @report_element{"sort_by"} = "ssessions"; ); # Change sort_by=events to sort_by=ssession_event if ((report_name eq "individual_sessions") and report_element?{"sort_by"} and (@report_element{"sort_by"} eq "events")) then ( @report_element{"sort_by"} = "ssession_events"; ); # There is no show_graph option in report elements in v8 profiles; remove it. if (report_element?{"show_graph"}) then delete_node(report_element{"show_graph"}); # If there is a sub_table section, convert it to drill_down. if (report_element?{"sub_table"}) then ( node sub_table = report_element{"sub_table"}; rename_node(sub_table, "drill_down"); if (sub_table?{"ending_row"}) then rename_node(sub_table{"ending_row"}, "number_of_rows"); # drill_down has no omit_parenthesized_items in v8, so delete it if it's there. if (sub_table?{"omit_parenthesized_items"}) then delete_node(sub_table{"omit_parenthesized_items"}); # show_omitted_items_row is called show_remainder_row in v8, so rename it if it's there. if (sub_table?{"show_omitted_items_row"}) then rename_node(sub_table{"show_omitted_items_row"}, "show_remainder_row"); # Use the second field's field_name as the report field, and then delete that column. sub_table{"report_field"} = @report_element{"columns"}{1}{"field_name"}; delete_node(report_element{"columns"}{"1"}); # Mark this as a subtable report @report_element{"subtable"} = true; ); # if sub_table # Touch up the columns if (report_element?{"columns"}) then ( node columns = report_element{"columns"}; #echo("columns: " . node_as_string(columns)); # Don't show the averages row. @report_element{"show_averages_row"} = false; # If there is no omit_parenthesized_items option, add one. if (!(report_element?{"omit_parenthesized_items"})) then ( if (report_element_name ne "log_detail") then @report_element{"omit_parenthesized_items"} = true; ); # If this is the search_phrase_by_search_engine report, v8 does not include a search_phrase column, so remove it. # string subtable_report_field = ""; # if (report_element_name eq "search_phrase_by_search_engine") then ( # subtable_report_field = @columns{1}{"field_name"}; # delete_node(columns{"1"}); # ); int new_column_name = 0; bool found_graph_column = false; for (int column_number = 0; column_number < num_subnodes(columns); column_number++) ( #echo("column_number: " . column_number); node column = subnode_by_number(columns, column_number); #echo("column: " . node_as_string(column)); # If this is the log_detail, and it's the "page_views" column, add a "hits" column too. if ((report_element_name eq "log_detail") and (node_name(column) eq "page_views") and (entries_field_name ne "")) then ( # if ((report_element_name eq "log_detail") and (entries_field_name ne "")) then ( node entries_field_column = new_node(); rename_node(entries_field_column, column_number); @entries_field_column{"report_field"} = entries_field_name; @entries_field_column{"show_column"} = true; @entries_field_column{"show_percent_column"} = false; @entries_field_column{"show_bar_column"} = false; insert_node(columns, entries_field_column, column_number); column_number++; column = subnode_by_number(columns, column_number); ); # log_detail # If this is the date_time column of log detail, replace it with year, month, and day columns. if ((report_element_name eq "log_detail") and (node_name(column) eq "date_time")) then ( node year_column = 'volatile'{"date_time_timestamp"}; @year_column{"report_field"} = "date_time_timestamp"; @year_column{"show_column"} = true; insert_node(columns, year_column, column_number); # node year_column = 'volatile'{"year"}; # @year_column{"field_name"} = "year"; # @year_column{"show_column"} = true; # insert_node(columns, year_column, column_number); # # node month_column = 'volatile'{"month"}; # @month_column{"field_name"} = "month"; # @month_column{"show_column"} = true; # insert_node(columns, month_column, column_number + 1); # # node day_column = 'volatile'{"day"}; # @day_column{"field_name"} = "day"; # @day_column{"show_column"} = true; # insert_node(columns, day_column, column_number + 2); delete_node(column); column = year_column; ); # if date_time column # If this is the location column of log detail, replace it with country, region, and city. if ((report_element_name eq "log_detail") and (node_name(column) eq "location")) then ( node country_column = 'volatile'{"country"}; @country_column{"field_name"} = "country"; @country_column{"show_column"} = false; insert_node(columns, country_column, column_number); node region_column = 'volatile'{"region"}; @region_column{"field_name"} = "region"; @region_column{"show_column"} = false; insert_node(columns, region_column, column_number + 1); node city_column = 'volatile'{"city"}; @city_column{"field_name"} = "city"; @city_column{"show_column"} = false; insert_node(columns, city_column, column_number + 2); delete_node(column); column = country_column; ); # if location column # If this is the page column of log detail, also add a page_directory columns. if ((report_element_name eq "log_detail") and (node_name(column) eq "page")) then ( node page_directory_column = new_node(); rename_node(page_directory_column, column_number); @page_directory_column{"report_field"} = "page_directory"; @page_directory_column{"show_column"} = true; insert_node(columns, page_directory_column, column_number); column_number++; column = subnode_by_number(columns, column_number); # delete_node(column); # column = page_directory_column; ); # if page column of log_detail # If this is log_detail, v8 sets show_percent_column and show_bar_column; do that here. # SUSPECT: v8 bug? if ((report_element_name eq "log_detail") and ((node_name(column) eq "day_of_week") or (node_name(column) eq "hour_of_day"))) then ( @column{"show_percent_column"} = false; @column{"show_bar_column"} = false; ); # If this is the log_detail, v8 numbers columns if (report_element_name eq "log_detail") then ( rename_node(column, column_number); ); # log_detail # Get the report field name for this column string report_field_name = @column{"field_name"}; #echo("report_field_name 1: " . report_field_name); # 2008-10-21 - GMF - If field_name is not set but report_field is (as in one example I just saw, page_directory in an apache report), use report_field. if ((report_field_name eq '') and (column?{"report_field"})) then report_field_name = @column{"report_field"}; #echo("report_field_name 2: " . report_field_name); #echo("report_element_name: " . report_element_name); # 2008-08-01 - GMF - We can't convert all "events" to "session_events", because some plug-ins actually use "events" as a numerical field. # Similarly for other fields. So, only do this sort of conversion in a session report. # 2008-12-08 - GMF - Change report_element_name to report_element_type, because the name doesn't always match (e.g., in the Single-page summary, where it's a number). # if ((report_element_type eq "exit_pages") or # (report_element_type eq "entry_pages") or # (report_element_type eq "session_pages") or # (report_element_type eq "session_users") or # (report_element_type eq "individual_sessions")) then ( # if (report_field_name eq "sessions") then # report_field_name = "ssessions"; # if (report_field_name eq "page") then # report_field_name = "ssession_page"; # if (report_field_name eq "events") then # report_field_name = "ssession_events"; # if (report_field_name eq "time_spent") then # report_field_name = "ssession_duration"; # if (report_field_name eq "user") then # report_field_name = "ssession_user"; # if (report_field_name eq "session_id") then # report_field_name = "ssession_id"; # if (report_field_name eq "start_time") then # report_field_name = "ssession_begin"; # if (report_field_name eq "end_time") then # report_field_name = "ssession_end"; ##echo("report_field_name 3: " . report_field_name); # # # 2008-10-21 - GMF - Convert the v7 field names in session reports to v8 equivalents # # 2008-12-08 - GMF - Changed "page" to page_field_name, so it will work with IIS and other formats where the page field isn't called "page" # if (report_field_name eq page_field_name) then # report_field_name = @field_options{"sessions_page_field"}; # # ); # if session report element # if (@column{"field_name"} eq "sessions") then ( # delete_node(column); # ); # if session column if (@column{"report_field"} eq "date_time_timestamp") then report_field_name = "date_time_timestamp"; #echo("report_field_name: " . report_field_name); #echo("here"); # If report field doesn't exist, delete the column. This particular will happen for session fields. if (!(v8profile{"statistics"}{"report_fields"}?{report_field_name})) then ( # echo("report fields 1: " . node_as_string(v8profile{"statistics"}{"report_fields"})); # echo("report element: " . node_as_string(report_element)); # error("Can't find report field ('" . report_field_name . "') for column: " . node_as_string(column)); # echo("Can't find report field ('" . report_field_name . "') for column: " . node_as_string(column)); # echo("Can't find report field ('" . report_field_name . "') for column; deleting column"); delete_node(column); ); # If report field exists, carry on. else ( # Set the report_field of the column @column{"report_field"} = report_field_name; # if (matches_regular_expression(@column{"label"}, '^[{]=capitalize[(]pluralize[(]print[(]database[.]fields[.]([a-z0-9_]+).label[)][)][)]=[}]$')) then ( # @column{"label"} = '{=capitalize(pluralize(expand(lang_stats.field_labels.' . $1 . ')))=' . '}'; # ); # Get the report field for this column node report_field = v8profile{"statistics"}{"report_fields"}{(@column{"report_field"})}; # New v8 profiles have show_percent_column and show_bar_column true for the hits column. if ((report_element_name eq "broken_links") and (@column{"report_field"} eq "hits")) then ( @column{"show_bar_column"} = true; @column{"show_percent_column"} = true; ); # Columns do not have a type in v8 (report fields do); so remove it. if (column?{"type"}) then delete_node(column{"type"}); # Columns in v8 uses "show_column" instead of "visible", so rename it. if (column?{"visible"}) then ( rename_node(column{"visible"}, "show_column"); ); # Columns in v8 do not have a "field_name" value; so remove it. if (column?{"field_name"}) then delete_node(column{"field_name"}); # Columns in v8 do not have a "data_type" value; so remove it. if (column?{"data_type"}) then delete_node(column{"data_type"}); # Columns in v8 do not have a "header_label" value; so remove it. if (column?{"header_label"}) then delete_node(column{"header_label"}); # Columns in v8 do not have a "display_format_type" value; so remove it. if (column?{"display_format_type"}) then delete_node(column{"display_format_type"}); # Columns in v8 do not have a "main_column" value; so remove it. if (column?{"main_column"}) then delete_node(column{"main_column"}); # Columns in v8 do not have a "show_number_column" value; so remove it. if (column?{"show_number_column"}) then delete_node(column{"show_number_column"}); # Columns in v8 always have show_graph, even if it's false; add it if it's not there. # SUSPECT: Bug in v8? Why don't session reports have show_graph? if (!(column?{"show_graph"})) then ( #echo("report_field: " . node_as_string(report_field)); if ((@report_field{"type"} eq "int") or (@report_field{"type"} eq "float") or (@report_field{"type"} eq "unique")) then ( if ((report_element_name ne "log_detail") and (report_element_name ne "entry_pages") and (report_element_name ne "individual_sessions") and (report_element_name ne "session_pages") and (report_element_name ne "session_users") and (report_element_name ne "exit_pages") ) then @column{"show_graph"} = false; ); ); # Remember if there is a graphing column if ((column?{"show_graph"}) and (@column{"show_graph"})) then found_graph_column = true; # If this is the search_phrase_by_search_engine report, we deleted column 1, # so renumber the rest so a "diff" will show they match. if ((report_element_name eq "search_phrase_by_search_engine") and (node_name(column) > 0)) then ( rename_node(column, node_name(column) - 1); #echo("renamed: " . node_as_string(column)); ); # Convert report fields to session names in session reports. if (((report_element_name eq "entry_pages") or (report_element_name eq "exit_pages") or (report_element_name eq "session_users") or (report_element_name eq "individual_sessions") or (report_element_name eq "session_pages") or false )) then ( # if (@column{"report_field"} eq "page") then if (@column{"report_field"} eq page_field_name) then @column{"report_field"} = "ssession_page"; else if (@column{"report_field"} eq "sessions") then @column{"report_field"} = "ssessions"; else if (@column{"report_field"} eq "events") then @column{"report_field"} = "ssession_events"; else if (@column{"report_field"} eq "time_spent") then @column{"report_field"} = "ssession_duration"; else if (@column{"report_field"} eq "user") then @column{"report_field"} = "ssession_user"; else if (@column{"report_field"} eq "session_id") then @column{"report_field"} = "ssession_id"; else if (@column{"report_field"} eq "start_time") then @column{"report_field"} = "ssession_start_time"; else if (@column{"report_field"} eq "end_time") then @column{"report_field"} = "ssession_end_time"; ); # if session report # column_number++; ); # if not session column ); # foreach column if ((report_element_name ne "entry_pages") and (report_element_name ne "exit_pages") and (report_element_name ne "session_users") and (report_element_name ne "individual_sessions") and (report_element_name ne "session_pages")) then ( if (report_element_name ne "log_detail") then ( # if (sessions_exist) then ( # # # Add all numerical session columns # foreach session_field 'v.session_fields' ( # # if (@session_field{"default_in_reports"}) then ( # # # Check if the report column already exists; if it does, we don't want to add it again. # node checkcolumn; # bool columnAlreadyExists = false; # foreach checkcolumn columns ( # if (@checkcolumn{"report_field"} eq node_name(session_field)) then ( # columnAlreadyExists = true; # ); # ); # # # If it doesn't exist, add it # if (!columnAlreadyExists) then ( # # node column = columns{column_number}; # # @column{"report_field"} = node_name(session_field); # if ((node_name(session_field) eq "ssession_begin") or (node_name(session_field) eq "ssession_end")) then # @column{"show_column"} = false; # else # @column{"show_column"} = true; # @column{"show_percent_column"} = false; # @column{"show_bar_column"} = false; # @column{"show_graph"} = false; # column_number++; # # ); # if doesn't already exist # # ); # if numerical # # ); # for session fields # # ); # if sessions exist ); # if not log_detail # If this isn't log_detail, show the graphs. Actually, show it regardless; the v8 create profile wizard does. if (report_element_name eq "log_detail") then @report_element{"show_graphs"} = false; else @report_element{"show_graphs"} = true; # Always show the table @report_element{"show_table"} = true; ); # if not session report ); # if columns ); # if keep report element ); # if not session report element ); # foreach report_element ); # if keep report # echo("final report: " . node_as_string(report)); ); # foreach report #echo("Done converting statistics.reports"); ## ## CONVERT REPORTS MENU ## # Create a report_fields node node reports_menu = v8profile{"statistics"}{"reports_menu"}; subroutine(convert_reports_menu(node menu_node, string page_field_name), ( #echo("menu_node=" . node_as_string(menu_node)); for (int menu_subnode_num = 0; menu_subnode_num < num_subnodes(menu_node); menu_subnode_num++) ( node menu_subnode = subnode_by_number(menu_node, menu_subnode_num); #echo("menu_subnode=" . menu_subnode); #echo("menu_subnode: " . node_as_string(menu_subnode)); # Delete session reports if ((node_name(menu_subnode) eq "sessions_group") or (node_name(menu_subnode) eq "sessions_overview") or (node_name(menu_subnode) eq "exit_pages") or (node_name(menu_subnode) eq "entry_pages") or (node_name(menu_subnode) eq "entry_pages") or (node_name(menu_subnode) eq "session_pages") or (node_name(menu_subnode) eq "session_page_paths") or (node_name(menu_subnode) eq "session_paths") or (node_name(menu_subnode) eq "individual_sessions") ) then ( #echo("Deleting sessions report: " . @menu_subnode{"view_name"}); delete_node(menu_subnode); menu_subnode_num--; ); else ( # v8 does not use a "type" node, so delete it delete_node(menu_subnode{"type"}); # If it's a group, process each subitem recursively. if (menu_subnode?{"items"}) then ( node item; # foreach item (menu_subnode{"items"}) ( convert_reports_menu(menu_subnode{"items"}, page_field_name); # ); ); # if group # It's not a group; handle it as a report else ( # If this is the date_time report, replace it with years, months, and days if (@menu_subnode{"view_name"} eq "date_time") then ( node year_menu_subnode = new_node(); rename_node(year_menu_subnode, "year"); @year_menu_subnode{"view_name"} = "year"; insert_node(menu_node, year_menu_subnode, menu_subnode_num); node month_menu_subnode = new_node(); rename_node(month_menu_subnode, "month"); @month_menu_subnode{"view_name"} = "month"; insert_node(menu_node, month_menu_subnode, menu_subnode_num + 1); node day_menu_subnode = new_node(); rename_node(day_menu_subnode, "day"); @day_menu_subnode{"view_name"} = "day"; insert_node(menu_node, day_menu_subnode, menu_subnode_num + 2); #echo("0menu_node: " . node_as_string(menu_node)); delete_node(menu_subnode); menu_subnode = subnode_by_number(menu_node, menu_subnode_num); menu_subnode_num--; #echo("menu_node: " . node_as_string(menu_node)); #echo("menu_subnode_num: " . menu_subnode_num); ); # if date_time # If this is the location report, replace it with country, region, and city else if (@menu_subnode{"view_name"} eq "location") then ( node country_menu_subnode = new_node(); rename_node(country_menu_subnode, "country"); @country_menu_subnode{"view_name"} = "country"; insert_node(menu_node, country_menu_subnode, menu_subnode_num); node region_menu_subnode = new_node(); rename_node(region_menu_subnode, "region"); @region_menu_subnode{"view_name"} = "region"; insert_node(menu_node, region_menu_subnode, menu_subnode_num + 1); node city_menu_subnode = new_node(); rename_node(city_menu_subnode, "city"); @city_menu_subnode{"view_name"} = "city"; insert_node(menu_node, city_menu_subnode, menu_subnode_num + 2); delete_node(menu_subnode); menu_subnode = subnode_by_number(menu_node, menu_subnode_num); ); # if location else if (@menu_subnode{"view_name"} eq "days") then ( delete_node(menu_subnode); # menu_subnode = subnode_by_number(menu_node, menu_subnode_num); menu_subnode_num--; ); # if days else ( #echo("0menu_subnode: " . node_as_string(menu_subnode)); # v8 does not use a "label" node in report menu reports, so delete it delete_node(menu_subnode{"label"}); # v8 uses "report" instead of "view_name"; change it. if (menu_subnode?{"view_name"}) then rename_node(menu_subnode{"view_name"}, "report"); # Default to show this report in both dynamic and static modes. @menu_subnode{"show_in_dynamic_reports"} = true; if (@menu_subnode{"report"} eq "session_page_paths") then @menu_subnode{"show_in_static_reports"} = false; else @menu_subnode{"show_in_static_reports"} = true; #echo("menu_subnode: " . node_as_string(menu_subnode)); ); # if normal report if (menu_subnode?{"report"}) then ( # If this report is cs_uri_stem, change it to cs_uri_stem_directory (which is what we call that report in v8) if (@menu_subnode{"report"} eq page_field_name) then ( @menu_subnode{"report"} = page_field_name . "_directory"; ); # If this report is cs_uri_stem_bottom_level_items, change it to cs_uri_stem (which is what we call that report in v8) if (matches_regular_expression(@menu_subnode{"report"}, "^([a-z0-9_]+)_bottom_level_items$")) then ( @menu_subnode{"report"} = $1; ); ); # if report ); # if not group ); # if not session ); # for )); # convert_reports_menu() # Process the whole menu. convert_reports_menu(reports_menu, page_field_name); #echo("Done converting reports_menu"); ## ## CREATE create_profile_wizard_info ## node create_profile_wizard_info = v8profile{"create_profile_wizard_info"}; node cpwi_server = create_profile_wizard_info{"database"}{"options"}{"server"}; # Copy database_name @cpwi_server{"database_name"} = @create_profile_wizard_info{"mysql_database_name"}; delete_node(create_profile_wizard_info{"mysql_database_name"}); # Copy database_type if (@create_profile_wizard_info{"database_type"} eq "SDB") then @cpwi_server{"type"} = "internal_sql"; else @cpwi_server{"type"} = "mysql"; delete_node(create_profile_wizard_info{"database_type"}); # Copy hostname, username, and password @cpwi_server{"dsn"} = @create_profile_wizard_info{"mysql_server"}{"hostname"}; @cpwi_server{"hostname"} = @create_profile_wizard_info{"mysql_server"}{"hostname"}; @cpwi_server{"username"} = @create_profile_wizard_info{"mysql_server"}{"username"}; @cpwi_server{"password"} = @create_profile_wizard_info{"mysql_server"}{"password"}; delete_node(create_profile_wizard_info{"mysql_server"}); # Delete the server socket, which is not currently available in v8 delete_node(create_profile_wizard_info{"mysql_server_socket"}); #echo("Done converting create_profile_wizard_info"); ## ## ADD SNAPONS ## @v8profile{"snapons"}{"internal_optimize"} = ""; @v8profile{"snapons"}{"internal_optimize"}{"label"} = "Internal optimize"; @v8profile{"snapons"}{"internal_optimize"}{"snapon_name"} = "internal_optimize"; # Create the internal_optimize database filter node database_filters = v8profile{"database"}{"filters"}; @database_filters{"internal_optimize"} = ""; @database_filters{"internal_optimize"}{"expression"} = "internal_optimize_current_database_filter_row();"; ## ## RUN FINAL RESTRUCTURING/CLEANUP STEP ## include "templates.util.profile_structure.profile_structure_util"; restructure_profile(v8profile); ## ## CONVERT OVERVIEW TO REPORT-FIELD VERSION ## #echo(1); node report; node database_fields = v8profile{"database"}{"fields"}; foreach report (v8profile{"statistics"}{"reports"}) ( node report_element; foreach report_element (report{"report_elements"}) ( if (@report_element{"type"} eq "overview") then ( # echo("Found Overview"); node columns = report_element{"columns"}; node report_field; int nodenum = 0; foreach report_field (v8profile{"statistics"}{"report_fields"}) ( # echo("Considering adding report field " . report_field . " to columns"); if (report_field?{"database_field"} and (@report_field{"database_field"} ne "")) then ( # echo("Is database field"); node database_field = database_fields{@report_field{"database_field"}}; # echo("database_field: " . database_field); if ((database_field?{"aggregation_method"}) and (@database_field{"aggregation_method"} ne "none")) then ( # echo("Found aggregating database field: " . database_field); columns{nodenum}{"report_field"} = node_name(report_field); columns{nodenum}{"show_column"} = true; nodenum++; # echo("Added report column to overview"); ); # if aggregating field ); # if this report field is based on a database field ); # foreach report_fields ); # if overview ); # foreach report_element ); # foreach report #echo(2); ## ## WRITE THE info.cfg NODE ## string info_pathname = get_database_directory(v8profile) . "info.cfg"; write_file(info_pathname, "database_info = {\n initial_build_done = true\n}\n"); # Don't know who's asking for this, but it's easier just to give it to them. Without this, it gives an error on report viewing. @v8profile{"statistics"}{"label"} = ""; ## ## SAVE THE V8 PROFILE ## # Save the v8 profile #echo("Saving v8profile=" . v8profile); save_node(v8profile); # Return the v8 profile name node_name(v8profile); ## ## CHECK THE PROFILE AGAINST A KNOWN v8 PROFILE (ae) ## if ('volatile'?{"known_good_v8_profilename"}) then ( # echo("Checking against known good v8 profile: " . @'volatile'{"known_good_v8_profilename"}); # Check it against known good subroutine(trim(node x), ( # if (matches_regular_expression(x, '^converted_profiles[.]([^.]+[.].*)$')) then # $1; # else if (matches_regular_expression(x, '^profiles[.]([^.]+[.].*)$')) then # $1; # else x; )); subroutine(diff_nodes(node x, node y), ( # if (node_name(x) ne node_name(y)) then # echo(" Name differs for " . trim(x) . " and " . trim(y)); # if (node_value(x) ne node_value(y)) then # echo(" Value differs for " . trim(x) . " ('" . node_value(x) . "') and " . trim(y) . " ('" . node_value(y) . "')"); # Report all subnodes of x which are not in y; recursively compare those which are in y node sx; foreach sx x ( if (y?{node_name(sx)}) then diff_nodes(sx, y{node_name(sx)}); else ( # echo(" Node '" . trim(x) . "' has subnode '" . node_name(sx) . "', which does not exist in '" . trim(y) . "'"); # echo(" y=" .node_as_string(y)); ); ); # Report all subnodes of y which are not in x node sy; foreach sy y ( if (!(x?{node_name(sy)})) then ( # echo(" Node '" . trim(y) . "' has subnode '" . node_name(sy) . "', which does not exist in '" . trim(x) . "'"); # echo(" x=" .node_as_string(x)); ); ); )); # diff_nodes diff_nodes(v8profile, 'profiles'{(@'volatile'{"known_good_v8_profilename"})}); ); # if known_good_v8_profilename exists )); # subroutine convert_v7_profile