Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.

see #27704.


git-svn-id: https://develop.svn.wordpress.org/trunk@25825 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-10-17 04:01:06 +00:00
parent 21da24227f
commit 4644bb87f6
3 changed files with 26 additions and 3 deletions

View File

@@ -566,8 +566,17 @@ function wp_schedule_update_checks() {
if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
if ( !wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) )
wp_schedule_event( time(), 'twicedaily', 'wp_maybe_auto_update' );
if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
// Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
$next = strtotime( 'today 7am' );
$now = time();
// Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now.
while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) {
$next += 12 * HOUR_IN_SECONDS;
}
$next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' );
}
}
if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )