control-prefetch-cache.sh

Prefetches cache for cruise posts in a WordPress site, updating the database and processing cruise post IDs for live pricing.

Usage

./control-prefetch-cache.sh

Description

  • Determines the script directory and sources the functions script.
  • Defines the log file path.
  • Checks if the script is already running and exits if it is.
  • Logs the start of the prefetch cache process.
  • Truncates the ca_prefetch table in the database.
  • Reads post IDs from the database and processes each one for prefetching.
  • Logs the total number of prefetches.
  • Processes cruise post IDs for live pricing, limiting concurrent jobs.
  • Updates last updated time for cruise post IDs.
  • Waits for background jobs to finish.
  • Logs the end of the prefetch process.

Dependencies

  • functions.sh: Utility functions.
  • mysql: MySQL commands.
  • wp: WP-CLI for WordPress operations.
  • curl, xmlstarlet: Shell utilities.

Notes

  • Ensure all required environment variables and plugins are set before running.
  • Intended for use by developers or system administrators familiar with WordPress and server scripting.

For further details, refer to the comments in the script or contact the development team.