#27772 closed enhancement (fixed)
Add a TTL to Core update checks
Reported by: | dd32 | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Upgrade/Install | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently WordPress checks for a new version every 12 hours, and once per minute if you're hitting the updates page.
The attached patch introduces a TTL field in the core update response, this allows us to tell an install "Hey, there's an update coming out in the near future, can you please check for an updated version more often?".
The primary use of this would be to alert site administrators to an update as fast as possible, for example, if someone checks their Updates page at 10am, and we release an update at midday, presently they won't get an alert unless they view their updates page again, or visit their site again after 10pm.
Attachments (2)
Change History (12)
#2
@
11 years ago
This change will not help plugin security updates though, as they will still only be checked every 12 hours (Even if the background update callback is kicked off more often than that) as wp_update_plugins() has a 12hour timeout on it. We could reduce that timeout to 1hour for cron tasks though perhaps.
27772.2.diff does this, if wp_update_plugins()
is running within cron, we expect it to make a new request, so it drops the timeout to 0. (This also applies to themes)
#3
@
11 years ago
With respect to:
// Testing only, causes an update cron task to be run every 90seconds $body['ttl'] = 90;
Perhaps it's a sign that the API is missing a couple of hooks? :-)
#4
@
11 years ago
Perhaps it's a sign that the API is missing a couple of hooks? :-)
Perhaps it's just a sign that it's easier to add an extra API response field next to the code being tested, rather than having everyone modify the API response they see? (either by modifying the server code being hit, or filtering something)
#5
@
11 years ago
Hehe. I understand your reasoning, it's just that reading the two lines triggered a vivid reminder in me of how a few strategically placed hooks in the update API would be welcome.
In essence, if you as a core dev could easily test the ttl argument and similar using a plugin instead of by inserting debug code within the WP trunk, odds are that we plugin devs could more easily work with the update API. Related: #27124.
27772.diff includes some debug to trigger the check every 90seconds, using a plugin which lets you view cron tasks, reloading that page should show the event running and being re-queued.
The patch also contains a command to re-run Background updates after a version check has completed, however, this has a side effect of Background Update will now be run a minimum of 4 times daily, 7am/pm + a random hour of the day when the core version check is queued.
This does however also mean that in the event that we utilise the TTL to make WordPress re-check more often, we can have as many sites updated as fast as possible rather than waiting up to 12hours for all installs to get the message.
This change will not help plugin security updates though, as they will still only be checked every 12 hours (Even if the background update callback is kicked off more often than that) as wp_update_plugins() has a 12hour timeout on it. We could reduce that timeout to 1hour for cron tasks though perhaps.