Repository navigation
Version 4 introduces stricter failure handling for sync operations and project hooks. Review the README’s Migration from 3.x section before upgrading existing projects.
Breaking changes
- The main runner enables
set -eandpipefail. - All shell hooks run with
bash -eo pipefail, including existing before-import, custom search-replace, and post-sync hooks. - Unhandled command failures, failed pipelines, and nonzero hook exits can stop the sync before later operations run. Existing hooks must explicitly handle expected nonzero statuses.
- The remote export shell stops on export failure so compression cannot mask a failed export.
Completed operations are not automatically rolled back; a failed import can leave an incomplete destination database.
Added
after-db-import.sh, invoked after a successful import and before URL/path search-replace or post-sync extensions. It is skipped on failed imports and with--no-db-sync.- Exported lifecycle flags:
WP_ENV_SYNC_DB_SYNCandWP_ENV_SYNC_DB_IMPORTED. - Failure reporting and nonzero exit handling for interrupted or failed runs.
- Lifecycle tests using fake commands without connecting to WordPress, a database, or a remote server.
Maintenance behavior
Uses WordPress’s native maintenance marker and normal ten-minute expiry. Successful runs explicitly deactivate maintenance. Failed or interrupted runs leave that standard marker to expire normally.
Documentation and verification
The README documents the new hook in the hooks list, explains the v3-to-v4 migration, and corrects the existing post-sync hook filenames.
Validated with Bash syntax checks, ShellCheck, and all ten database lifecycle cases: successful sync, file-only sync, and failures during export, before-import hook, reset, import, after-import hook, hook pipeline, custom search-replace, and post-sync extension.