Closed brandonkal closed 1 year ago
I am hoping someone is willing and able to test this out and release it in or let me know what needs to change. I am glad the CI tests are passing now. I am not able to test this locally because it appears to have conflicts with the search-replace that is installed by default.
So I am seeing this even though I am passing 9 args in the new version:
Uncaught ArgumentCountError: Too few arguments to function WP_CLI\SearchReplacer::__construct(),
8 passed in phar:///usr/local/bin/wp/vendor/wp-cli/search-replace-command/src/Search_Replace_Command.php on line 489
and exactly 9 expected in
/home/brandonkal/.wp-cli/packages/vendor/wp-cli/search-replace-command/src/WP_CLI/SearchReplacer.php:31
I installed my fork as explained in the README:
wp package install git@github.com:brandonkal/search-replace-command.git
Thanks
Try updating to WP-CLI nightly
Installing the nightly version fixed the issue. Everything looks good so far but I will report back after some more thorough testing.
Tested thoroughly and everything looks good to go!
@brandonkal The PR looks good at first glance. We still need to add functional tests through Behat. Are you able to add these?
@brandonkal Are you interested in providing the required Behat tests to move this over the finish line?
@brandonkal Gentle ping to see if you are up for adding the needed tests...?
Thank you for the reminder @schlessera. I forgot about this. I am not very familiar with Behat and my WordPress projects are currently on hold so I expect it will be a few months before I can look into this again. If anyone is willing to add the tests in the meantime, I've allowed edits on this PR.
@wp-cli/committers There might be a much easier approach here: call apply_filters()
if it exists. What do you think?
I implemented callback support within #128
It relies upon callback's name being passed as an option, rely upon call_user_func
and should easily made a filter
.
From a quick look, a filter sounds better because:
Proceeding with https://github.com/wp-cli/wp-cli/issues/5594 for this repository. I've captured this PR to https://gist.github.com/danielbachhuber/f4bb0f6caaebc2c8a6390adc19cd1f50 in case this PR is auto-closed or broken in some way.
This PR adds the ability to run a user function on search results if a match is found. In my case, I needed this to change image src urls based on attachment id and size where a hash is a required part of the url.