CruiseAppy Script Functions
This document details the core functions utilized in CruiseAppy automation scripts and integrations. Each function is designed to perform a specific operation within the CruiseAppy backend, primarily interacting with the database, file system, or external APIs.
| Function | Technical Description |
|---|---|
obfuscate_credentials(file) |
Parses the specified file, identifies credential patterns, and replaces sensitive values with masked placeholders to prevent credential leakage. |
debug(search_id, post_id) |
Generates verbose diagnostic output for the provided search and post IDs, and persists debug logs to the database for traceability. |
error_check_response(response, search_id, error_message) |
Inspects API response objects for error states, logs detailed error information with context, and associates errors with the relevant search ID. |
cabingrades_temp_table_create(post_id) |
Programmatically creates a temporary SQL table scoped to the given post ID for staging cabin grade data during processing. |
cabingrades_temp_table_delete(post_id, farecode) |
Drops the temporary cabin grades table for the specified post and fare code, and migrates staged data to the persistent table. |
flat_file_pricing(search_id) |
Parses and imports pricing data from flat files into the database, associating records with the given search ID. |
update_best_price(post_id, sessionkey) |
Executes a price comparison algorithm to determine and update the lowest available price for the specified post and session. |
update_search_price() |
Triggers a batch update to refresh all cached search price data in the database, ensuring pricing accuracy. |
get_ship_post_id(ship_code) |
Queries the database to retrieve the post ID and ship name corresponding to the provided ship code. |
log_and_rotate() |
Performs log file rotation, archiving current logs, and initiates a backup of the database to maintain data integrity. |
holiday_search_sid(search_type) |
Sets or retrieves the session identifier for holiday searches, parameterized by search type, to maintain session continuity. |
get_ship_detail_image_name(image_item, image_name) |
Downloads a ship detail image from a remote source and saves it locally using a standardized naming convention. |
cs_get_token(line_id) |
Requests and returns an authentication token for the specified cruise line, facilitating secure API communication. |
vmb_post_id(bookingid, bookingreference) |
Retrieves or creates a unique post ID for a booking, using the booking ID and reference as keys. |
wp_add_portfolio_details(bookingid, post_id) |
Inserts or updates portfolio metadata for a booking in the WordPress database, linked to the specified post. |
wp_add_portfolio_documents(bookingid) |
Attaches and indexes portfolio-related documents to the booking record in the content management system. |
wp_add_portfolio_cruise(bookingid, post_id) |
Associates cruise-specific data with a booking and updates the corresponding post entry. |
wp_add_portfolio_passengers(bookingid, post_id) |
Adds or updates passenger manifest details for a booking, linked to the relevant post. |
wp_add_package_details(bookingid, file, post_id) |
Parses package detail files and updates the booking record and associated post with extracted data. |
mysql_portfolio_details(bookingid, file) |
Imports and maps portfolio details from an XML file into the MySQL database, keyed by booking ID. |