-
Notifications
You must be signed in to change notification settings - Fork 1k
add multisite find & replace functionality #481
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 multisite find & replace functionality #481
Conversation
php/commands/search-replace.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use $wpdb->tables( 'global' )?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect ;)
|
@scribu I have tested this by changing a username and blog name, and checked that the |
|
The next step would be to make it mergea-ble into master again (I merged #473 recently).
|
|
Or, the more familiar route, merge master into the branch (and resolve conflicts). |
|
You squashed all the commits into one, but the parent commit is still the old one. The latest HEAD in master is 5432c54 |
|
@scribu sorry, think I might have merged with master twice after you. Got numerous errors when trying to merge the pr with |
|
Just do this: |
|
typo: |
|
also from my config: |
|
Right, |
|
looking at the network chart not sure if that went through right? |
|
It's good now. |
php/commands/search-replace.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the fix here to ignore the first column?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it - just above fields is set to array( $primary_key, $col ), so the first column is null. But I worry about the update later on. It seems to me if null is passed for the $where argument, no updates will be made. I think the current strategy requires a primary key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it. Two possible solutions:
a) skip tables which don't have a primary key column
b) for tables without a primary key column, assume they don't have serialized values and do a single UPDATE query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of wp_signups, there is a field ('meta') that contains serialized data. Option a) seems safer to me. Maybe instead of zero column counts in the output for that table we could have an output row indicating the table was skipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a plan. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daithi-coombes This hasn't been resolved.
|
cc: @cyberhobo |
|
Just to clear up any misunderstandings: @daithi-coombes Do you think you'll have time to continue working on this? Let me know if anything is unclear. |
|
sure I have time. Will start on it imediately |
|
Alright. Just shout when you think the code is ready for another review or if you get stuck. |
features/steps/basic_steps.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just add this as a regular step to the "Given" part of the scenario:
Given a WP multisite install
And I run `wp blog --slug="foo" --title="foo" --email="foo@example.com"`
And ...
When I run `wp search-replace foo bar --multisite`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible because Behat doesn't care if a step is defined with $step->Given() or $step->Then().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove this unused step definition.
It will be ready for merge when all the inline comments are gone: https://github.com/wp-cli/wp-cli/pull/481/files (they disappear once the line of code they reference is removed or changed) |
|
I have added One issue is that its failing the CI test (the 3rd ci test) but I can't recreate the failure on my machine |
Are you sure that you're running the tests against WP 3.4.2? You just need to run: and then run the search-replace tests. |
features/search-replace.feature
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just noticed... if a user's password hash contains the keyword being replaced then there will be login issues. Is there currently a blacklist of tables:cols?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! No blacklist, currently.
|
ready for review, if go-ahead, then i'm gonna: git fetch upstream
git reset upstream/master
git commit -am "merge msg"
git push -f? |
php/commands/search-replace.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is redundant (you could get the same information by just looking at the code); explain the "why", not the "how".
|
It looks good. The only minor complaint I have left is inconsistent use of whitespace. For example: should be: I'll let you guess what the next one should be: See http://make.wordpress.org/core/handbook/coding-standards/php/#space-usage |
|
done ;) Cheers for the tips, especially commenting the "why" and not "how", learn something new everyday |
|
Alright; please combine all your commits into one again. I'll merge soon. |
|
Merged via #501. Thanks for getting this off the ground, @daithi-coombes! |
forked from #278