Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#27772 closed enhancement (fixed)

Add a TTL to Core update checks

Reported by: dd32's profile dd32 Owned by: nacin's profile 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)

27772.diff (2.0 KB) - added by dd32 11 years ago.
27772.2.diff (4.3 KB) - added by dd32 11 years ago.

Download all attachments as: .zip

Change History (12)

@dd32
11 years ago

#1 @dd32
11 years ago

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.

Last edited 11 years ago by dd32 (previous) (diff)

@dd32
11 years ago

#2 @dd32
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)

Last edited 11 years ago by dd32 (previous) (diff)

#3 @Denis-de-Bernardy
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 @dd32
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 @Denis-de-Bernardy
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.

#6 @nacin
11 years ago

  • Milestone changed from Awaiting Review to 3.9

#7 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 28129:

Add a TTL to core update checks to allow us to narrow the 12-hour update window.

props dd32.
fixes #27772.

#8 @dd32
9 years ago

In 36180:

Background Updates: Remove the 7am/7pm background update check. This check was made redundant by [28129] as background updates are now run after a version check takes place.

See #27772, #35323.

#9 @dd32
9 years ago

In 36184:

Background Updates: Remove the 7am/7pm background update check.

This changeset is a more basic version of [36180], clearing the extra now redundant schedule.
As the functionality for this was introduced in 3.9, [28129] has been backported to 3.7/3.8, allowing the API TTL to be respected by those versions.

See #27772.
Fixes #35323.

#10 @DrewAPicture
9 years ago

In 36825:

Docs: Improve documentation for upgrade_450(), introduced in [36180].

See #27772, #35323. See #35986.

Note: See TracTickets for help on using tickets.