control-flat-files.sh
Processes XML files and imports data into a MySQL database for a WordPress site, handling multilingual data and updating related tables.
Usage
./control-flat-files.sh
Description
- Checks if the script is already running to prevent multiple instances.
- Detects WPML plugin and sets source folders accordingly.
- Deletes existing data from specific tables based on language.
- Loops through source folders and processes each XML file.
- Imports data from XML files into MySQL tables.
- Imports itinerary data from specific XML files.
- Updates imported data with ship, cruise line, and post IDs.
- Deletes outdated or irrelevant data from the database.
- Updates post status in WordPress based on imported data.
Variables
script_path: Path to the script directory.source_folders: Folders containing XML files.file_language: Language of files being processed.default_lang: Indicates if language is default.ca_db_name: MySQL database name.ca_db_table_prefix: WordPress table prefix.ca_wpml: WPML plugin status.ca_cabin_select: Cabin select feature status.
Dependencies
functions.sh: Utility functions.pidof: Process check.mysql: MySQL commands.jq: JSON parsing.
Notes
- Ensure necessary variables are set and required plugins are installed 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.