# # # verify_caches() # # # # Checks/creates profile cache, basic data and session files for dynamic and static reports. # include "templates.statistics.util.verify_caches_util"; subroutine(verify_caches( string session_id, bool read_extended_profile_dat_from_sessions, bool is_root_admin, node profile, string profile_name, node basic_ids), ( # read_extended_profile_dat_from_sessions is true # if reports are generated by a web browser interaction. In this case the extended_profile_dat.cfg file # exists in sessions_cache and not in profiles_cache (See docs for more details) debug_message("#### verify_caches() START \n"); debug_message("#### verify_caches() - read_extended_profile_dat_from_sessions: " . read_extended_profile_dat_from_sessions . "\n"); string extended_profile_dat_id = @basic_ids{"extended_profile_dat_id"}; # # # # Check profiles_cache directories # # # check_profile_cache_integrity(profile_name); # # # # Check extended_profile_dat existence and up to date state # # # string extended_profile_dat_path; if (read_extended_profile_dat_from_sessions) then ( extended_profile_dat_path = "sessions_cache." . session_id . ".profiles." . profile_name . ".extended_profile_dat"; ) else ( extended_profile_dat_path = "profiles_cache." . profile_name . ".extended_profile_dat"; ); bool extended_profile_dat_exists = (?(extended_profile_dat_path)); bool extended_profile_dat_is_up_to_date = false; debug_message("#### verify_caches() - extended_profile_dat_exists: " . extended_profile_dat_exists . "\n"); if (extended_profile_dat_exists) then ( # # extended_profile_dat exists, check if it is up to date # if (@(extended_profile_dat_path . ".extended_profile_dat_id") eq extended_profile_dat_id) then ( extended_profile_dat_is_up_to_date = true; ); ); debug_message("#### verify_caches() - extended_profile_dat_is_up_to_date: " . extended_profile_dat_is_up_to_date . "\n"); if (!extended_profile_dat_exists or !extended_profile_dat_is_up_to_date) then ( # Create/re-create extended_profile_dat create_extended_profile_dat(profile, extended_profile_dat_id, extended_profile_dat_path); debug_message("#### verify_caches() - CREATE NEW EXTENDED PROFILE DAT: YES\n"); ) else ( debug_message("#### verify_caches() - CREATE NEW EXTENDED PROFILE DAT: NO\n"); ); # DISABLED # check_extended_profile_dat_integrity(session_id, profile_name); # if (!is_root_admin) then ( # Check if query_fields exists in sessions_cache for non-root-admin users # DISABLED # check_query_fields_integrity_in_sessions(session_id, profile_name); # KHP-RC # We also have to check if the users_cache profile data of this user # are up to date). # We should do this check only one time, before viewing the profile reports, # so we can do this together with the query_fields for this user, if # they don't exist we know we need to check users_cache integrity. # # The users_cache integrity check must ensure that the user_info statistics_date # node does not contain any invalid reports data. This could be the case # if an administrator changes the report by adding/removing columns or # by renaming report_fields, etc. # # # ); debug_message("#### verify_caches() END \n"); ));