control-cruises.sh
Performs database operations for cruise data.
Usage
./control-cruises.sh
- Run from the scripts directory with required environment and dependencies available.
- Requires WordPress CLI (
wp), MySQL, and access to the correct database and tables.
Steps
- Determines script directory and sources
functions.sh. - Defines log file path.
- Prevents multiple instances (checks for running process).
- Executes MySQL commands to update/manage cruise data:
- Updates post type and IDs in cabingrades and cruises tables.
- Updates prices in cruises table from prices table.
- Updates meta values in WordPress postmeta.
- Inserts new records for cabin types and prices (inside, outside, balcony, suite, with/without flights).
- Handles translations if WPML is active (
ca_wpml). - Handles expired cruises (commented out in script).
Variables Used
script_path: Path to the script directory.wordpress_path: Path to WordPress installation.ca_db_name,ca_db_table_prefix: WordPress database name and table prefix.ca_wpml: WPML plugin status.
Dependencies
functions.sh: Sourced for utility functions.- MySQL: For DB operations.
- WordPress CLI (
wp): For post operations (if used elsewhere).
Notes
- Prevents concurrent execution for data integrity.
- Handles both cruise-only and flight-inclusive cabin grades.
- Some operations for expired cruises are present but commented out.