config.sh

Sets up necessary directories and retrieves configuration options from a WordPress database for CruiseAppy automation scripts.

Usage

./config.sh

Description

  • Creates required directories: csv, json, log, traveltek, xml (script path), and log, volume (WordPress path).
  • Sets up access control by creating .htaccess and .htpasswd in the xml directory to restrict access.
  • Retrieves database name and table prefix from WordPress configuration, determines connection method based on database type.
  • Fetches various WordPress options and assigns them to variables, with defaults if not set.

Variables

All variables set by config.sh:

  • script_path: Path to the script directory (where config.sh is located).
  • wordpress_path: Path to the WordPress installation, derived from script path.
  • cache_dir: Directory for cached DB variables (.cache in script path).
  • cache_file: File for cached DB variables (ca_vars.cache).
  • cache_ttl: Cache time-to-live in seconds (default: 86400, 24h).
  • ca_db_name: WordPress database name (from wp-config).
  • ca_db_table_prefix: WordPress table prefix (from wp db prefix).
  • ca_db_connect: MySQL connection string (default: --login-path=local).

WordPress Option Variables

  • ca_app: Application settings.
  • ca_at_sea: At sea mode.
  • ca_cabin_select: Cabin selection feature status.
  • ca_call_for_price: Call for price setting.
  • ca_cruise_cache: Cruise cache setting.
  • ca_destinations: Destinations setting.
  • ca_margin_safeguard: Margin safeguard setting.
  • ca_payment_gateway: Payment gateway settings.
  • ca_search: Search settings.
  • ca_smart_package: Smart package settings.
  • ca_tt_cc_payments: Credit card payment settings.
  • ca_tt_currency: Currency settings.
  • ca_tt_endpoint: API endpoint.
  • ca_tt_endpoint_secure: Secure API endpoint.
  • ca_tt_ftp_endpoint: FTP endpoint.
  • ca_tt_ftp_password: FTP password.
  • ca_tt_ftp_username: FTP username.
  • ca_tt_language: Language code.
  • ca_tt_marketid: Market ID.
  • ca_tt_packages: Package settings.
  • ca_tt_password: API password (URI encoded via jq).
  • ca_tt_sid: API SID.
  • ca_tt_sitename: API site name.
  • ca_tt_status: API status (Live/Test, 1=Live, else Test).
  • ca_tt_username: API username.
  • ca_website_url: Website URL (from siteurl option).
  • ca_wordpress_path: WordPress path from DB option.
  • ca_wpml: WPML plugin status (default: 0 if not set).
  • ca_payment_passthrough: Payment passthrough settings.
  • ca_tt_mmb_endpoint: Manage My Booking endpoint.
  • ca_tt_booking_endpoint: Booking endpoint (default: https://secure.traveltek.net/fusionapi/0.9/interface.pl if not set).
  • ca_theme: Active theme name (from template option).

Cabin Select API Variables

  • ca_cabin_select_username: Cabin select API username.
  • ca_cabin_select_password: Cabin select API password.
  • ca_cabin_select_api_endpoint: Cabin select API endpoint.
  • ca_cabin_select_channel: Cabin select channel.
  • ca_cabin_select_channel_partner: Cabin select channel partner.
  • ca_cabin_select_holding_image: Cabin select holding image.

Notes

  • Most variables are set from WordPress options table via MySQL queries.
  • Some variables have defaults if not set in the DB (see script for details).
  • Passwords and sensitive values may be URI encoded or protected.
  • Caching is used to avoid repeated DB queries; use --flush-cache to reset.
  • Access to the xml directory is restricted via .htaccess and .htpasswd.