Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@westonruter Thanks for review/suggestions! Changed as suggested |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
westonruter
left a comment
There was a problem hiding this comment.
I just tried running the new unit tests here but without the change to src/wp-admin/includes/class-wp-upgrader.php. The result is they still pass. I think the tests need to recreate the error scenario to demonstrate that the change to the create_lock method fixes something.
|
Oh, but:
And I'm running MySQL. |
| $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'off') /* LOCK */", $lock_option, time() ) ); | ||
|
|
||
| if ( ! $lock_result ) { | ||
| if ( 0 === $lock_result ) { |
There was a problem hiding this comment.
I've chatted with @afragen about this. We're unsure how this actually makes a chance. If the query method “returns an integer value indicating the number of rows affected/selected” then a value of zero is just as falsy as false, so the result would be the same?
There was a problem hiding this comment.
What is the actual return value from MariaDB if no matching row is found?
What I found in searching was it returns an empty set but I don't know the exact syntax of it. It's possible that that could be the difference.
There was a problem hiding this comment.
There are instances in WPDB::query() where the return value is false and 0 !== false. While this gives the expected result it seems sloppy as the return is an actual boolean.
|
I asked @costdev to take a look and here are his thoughts. |
|
Closing, since the actual bug is in caching and different approach is needed. |
Check for correct return value in
create_lock()in lock creating query.wpdb::query()returns0when there are no rows affected, eg. the lock already exists and noINSERTwas performed.Add two tests for
WP_upgrader::create_lock()Trac ticket: https://core.trac.wordpress.org/ticket/64080
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.