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

Explain the purpose of the --precise flag #91

Open
johnbillion opened this issue Aug 26, 2018 · 3 comments
Open

Explain the purpose of the --precise flag #91

johnbillion opened this issue Aug 26, 2018 · 3 comments

Comments

@johnbillion
Copy link
Contributor

The description of the --precise flag suggests that default results are not precise. Is this the case?

I think the description of this flag needs to be improved, and possibly an example added to the Examples section demonstrating when it should be used.

@schlessera
Copy link
Member

My best guess is that some occurrences of the pattern to search might be hidden by escaping or serialization, and you'd need to iterate over the dataset with PHP and transform the data before looking for the pattern to match them. A pure SQL query will miss these.

@roborourke
Copy link

Could it be aliased to --use-php instead?

@tomjn
Copy link
Contributor

tomjn commented Jul 21, 2020

Current doc for easy reference:

https://github.com/wp-cli/search-replace-command/blob/master/src/Search_Replace_Command.php#L90-L92

	 * [--precise]
	 * : Force the use of PHP (instead of SQL) which is more thorough,
	 * but slower.

It's directly read into the php_only variable:

		$php_only              = \WP_CLI\Utils\get_flag_value( $assoc_args, 'precise' );

https://github.com/wp-cli/search-replace-command/blob/master/src/Search_Replace_Command.php#L171

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

No branches or pull requests

4 participants