mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-02 13:15:17 +09:00
Changing a WordPress site's URL is not a single UPDATE: the URL is embedded across wp_options, post content, and PHP-serialized blobs whose byte-length prefixes break under a naive REPLACE. This adds a first-class swap tool built on WP-CLI search-replace (serialization-safe), with the rails to make it routine: - preview_url_change: dry-run that reports per-pair replacement counts, no writes - change_site_url: backs the database up first, rewrites with --skip-columns=guid (full-URL + host-only pairs so scheme/protocol-relative refs are covered), updates home/siteurl, flushes the object cache + permalinks, then re-points the primary Domain row and nginx vhost. Rolls the DB back from the backup on failure. keep_old_redirect keeps the old host resolving so WordPress 301s it. - POST /sites/<id>/url/preview and /sites/<id>/url (admin-gated) - "Change URL" modal on the site detail page: live dry-run preview, backup notice, keep-old-address toggle, then apply. _write_app_vhost is factored out of _provision_routing and shared by the re-point path. The pure-SQL search-replace in db_sync_service remains the offline-dump fallback only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>