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

  1. Determines script directory and sources functions.sh.
  2. Defines log file path.
  3. Prevents multiple instances (checks for running process).
  4. Executes MySQL commands to update/manage cruise data:
  5. Updates post type and IDs in cabingrades and cruises tables.
  6. Updates prices in cruises table from prices table.
  7. Updates meta values in WordPress postmeta.
  8. Inserts new records for cabin types and prices (inside, outside, balcony, suite, with/without flights).
  9. Handles translations if WPML is active (ca_wpml).
  10. 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.