[wp-trac] [WordPress Trac] #44118: WordPress performs some unnecessary plugin update checks
WordPress Trac
noreply at wordpress.org
Thu May 17 01:50:49 UTC 2018
#44118: WordPress performs some unnecessary plugin update checks
--------------------------+-----------------------------
Reporter: siliconforks | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
In the function `wp_update_plugins()`, it seems clear that the intent is
not to check for updates if there has already been an update check
recently (e.g., on the wp-admin/plugins.php page, "recently" means within
the last hour). However, in some cases it will check for updates anyway
because of subtle issues in the implementation.
The easiest way to reproduce the issue is to install the
[https://wordpress.org/plugins/query-monitor/ Query Monitor] plugin (to
view HTTP requests) and then perform the following steps:
1. Visit the admin section "Updates" page (wp-admin/update-core.php).
Look at Query Monitor's "HTTP API Calls" - you should see a call to
https://api.wordpress.org/plugins/update-check/1.1/ to check for plugin
updates. (You might also see additional HTTP API calls for theme and core
update checks.) Note: if you don't see the plugin update check, it's
possible that there was already a check for updates in the last minute -
update-core.php is supposed to check for updates no more than once per
minute. Try waiting a minute and reloading the page.
2. Once you have seen the plugin update check being made, visit the
"Plugins" page (wp-admin/plugins.php). Look at "HTTP API Calls" - you
will see another plugin update check being made. This doesn't make much
sense, because WordPress just checked for plugin updates on the update-
core.php page.
3. Note that the additional update check in only occurs once. Try
reloading the plugins.php page and look at "HTTP API Calls" again - this
time there will be no plugin update check (which is the expected behavior,
since WordPress just checked for plugin updates).
Looking at the code for `wp_update_plugins()`, it seems that the
`update_plugins` transient is sometimes stored with a `checked` property,
sometimes not. This doesn't make sense to me - when the `checked`
property is not stored in the transient, the next call to
`wp_update_plugins()` will always check for updates regardless of how
recently the last update check occurred.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44118>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list