From 4644bb87f6ac35e227947e36f1210eda6491eeff Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 17 Oct 2013 04:01:06 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/upgrade.php | 14 ++++++++++++++ src/wp-includes/update.php | 13 +++++++++++-- src/wp-includes/version.php | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index cfbaac8d84..ac05991a13 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -402,6 +402,9 @@ function upgrade_all() { if ( $wp_current_db_version < 22422 ) upgrade_350(); + if ( $wp_current_db_version < 25824 ) + upgrade_370(); + maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -1208,6 +1211,17 @@ function upgrade_350() { wp_delete_term( $term->term_id, 'post_format' ); } +/** + * Execute changes made in WordPress 3.7. + * + * @since 3.7.0 + */ +function upgrade_370() { + global $wp_current_db_version; + if ( $wp_current_db_version < 25824 ) + wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' ); +} + /** * Execute network level changes * diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php index 9fba7b1f06..df1feb9c1d 100644 --- a/src/wp-includes/update.php +++ b/src/wp-includes/update.php @@ -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 ) ) diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php index 05b2c789c6..44cec95809 100644 --- a/src/wp-includes/version.php +++ b/src/wp-includes/version.php @@ -11,7 +11,7 @@ $wp_version = '3.7-beta2-25801-src'; * * @global int $wp_db_version */ -$wp_db_version = 25448; +$wp_db_version = 25824; /** * Holds the TinyMCE version