Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search-replace extension for multisites #521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JoosuaKoskinen
Copy link
Contributor

What are the main changes in this PR?

Extends wp-cli wp search-replace to replace DOMAIN_CURRENT_SITE on multisites when needed.

Prevents multisites from breaking on automatic domain changes or manual search-replace.

$ wp option get home
https://joosua.fi
$ grep -F htdocs/wp-config.php -e DOMAIN_CURRENT_SITE 
define( 'DOMAIN_CURRENT_SITE', 'joosua.fi' );

$ wp search-replace 'joosua.fi' 'wordpress.joosua.me' --quiet
$ wp cache flush
Success: The cache was flushed.

$ wp option get home
https://wordpress.joosua.me
$ grep -F htdocs/wp-config.php -e DOMAIN_CURRENT_SITE 
define( 'DOMAIN_CURRENT_SITE', 'wordpress.joosua.me' );

Copy link
Contributor

@sjaks sjaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not affected:
image
Affected:
image

Seems to change the domain to correct value so that the correct domain is used everywhere.
Dry-run and regex exclusions work and a git commit is created for changes.

LGTM!

modules/wp-cli.php Outdated Show resolved Hide resolved
Copy link
Contributor

@elguitar elguitar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

How should we document this? Currently the user will not expect that the search-replace will do stuff that it would not normally do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants