fix(clone): Prevents overwriting wp-config.php when cloning a remote site with a custom public directory #462
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change fixes a bug in the copy_site_files() function where the wp-config.php file from the remote site was copied and overwritten the local wp-config.php file when the remote site had a custom public directory.
Evidence:
sudo ee site clone root@192.168.100.20:custom-public.local .Problem.
The code only had
--exclude '/wp-config.php'(in the root)When the remote site had a custom
source_public_path(e.g.,/current/web),wp-config.phpwas located in/current/wp-config.phpSince the exclusion only covered the root (
/wp-config.php), rsync copiedwp-config.phpfrom the remote site, overwriting the local database settings and preventing synchronization from occurring correctly.Solution.
With the code update, it's possible to clone WordPress sites from remote servers with a customized public directory.
sudo ee site clone root@192.168.100.20:custom-public.local .Fixes #463