-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
This is tricky to test. The linked wc-api-dev plugin doesn't have the version set back, it's set to I'm out of time today to test further, but I can track down the "2 updates" bug tomorrow morning if you don't have any immediate ideas. (It could also be that I reloaded while it was autoupdating, but I don't think that should give me "2 updates"). |
Ahh, of course I linked the wrong one. It's been a long day of digging in WP core code. I've updated my testing directions with the correct copy.
I just tried testing this again myself and I only had a "1" appear in the wp-admin plugins menu. That sequence of actions makes me think that one of those loads is what finally kicked off the autoupdate (which is why you then got the email). The way WP CRON works is by setting a timestamp for next run, and then, on the next page load after that, the queued action is ran. WordPress plugin's system will still list the plugin as being available for update, giving users a chance to update since the auto-update code normally only runs twice a day -- so it's likely they would see a notice at some point. However I don't have any immediate ideas about why you would see 2 instead of 1 if nothing else updated (since that indicator can also show themes and core updates). Any help tracking it down is appreciated. |
It looks like the second update is Jetpack, which I think is coming from the beta testing plugin, so it's probably not an issue. After removing the beta-tester I'm not seeing the 2 updates anymore. I do still see the update indicator even after the update succeeds, and it sticks around until I go to the updates page (which I assume clears the transient and forces a check again). Some debugging on this leads me to the step right after updating, where the transient is cleared and rebuilt. |
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.
Looks good - correctly updated the plugin and removed the update indicator.
Auto updates were previously added in #16.
There was a problem with the auto-update logic. It worked with the testing instructions I provided (i.e. manually running
wp_maybe_auto_update()
), but doesn't seem to work out in the wild :(.I've spent quite a bit of time trying to track it down and I think I've discovered why.
The relevant part seems to be where we bail early for on
$transient->checked
aroundline 60
. This doesn't seem to always be set - specifically in the case ofDOING_CRON
.I also looked at what our very own Woo Helper is doing, as well as a couple other GH update plugins and they don't bail like this. They check against the internal version of the plugin and add to the list of plugins to be updated.
The other addition here I made is storing the raw GitHub response (containing the latest release) in a transient. It's a short lived transient, but I wanted to avoid making multiple calls to the endpoint in rapid succession.
To Test (preferably on your AT site):
reschedule-version-check.zip. It allows you to easily schedule the next version check to make testing easier, and will send a WordPress debug email with auto-update results.
https://cloudup.com/c5PYieevCBA
which contains a zipped copy of this branch. There is one different between this zip and the PR here. I have set the version to
0.7.9
, so that when you are testing, the version will be seen as out of date.wc-api-dev
plugin and activate.https://:site?version-check=reschedule
which should schedule a version check/update for 2 minutes from now.You should receive an email like this: