WordPress.org

Make WordPress Core

Changeset 25825


Ignore:
Timestamp:
10/17/13 04:01:06 (4 years ago)
Author:
nacin
Message:

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.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r25448 r25825  
    403403        upgrade_350(); 
    404404 
     405    if ( $wp_current_db_version < 25824 ) 
     406        upgrade_370(); 
     407 
    405408    maybe_disable_link_manager(); 
    406409 
     
    12071210    if ( $wp_current_db_version < 22422 && $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ) ) 
    12081211        wp_delete_term( $term->term_id, 'post_format' ); 
     1212} 
     1213 
     1214/** 
     1215 * Execute changes made in WordPress 3.7. 
     1216 * 
     1217 * @since 3.7.0 
     1218 */ 
     1219function upgrade_370() { 
     1220    global $wp_current_db_version; 
     1221    if ( $wp_current_db_version < 25824 ) 
     1222        wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' ); 
    12091223} 
    12101224 
  • trunk/src/wp-includes/update.php

    r25823 r25825  
    567567        wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); 
    568568 
    569     if ( !wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) 
    570         wp_schedule_event( time(), 'twicedaily', 'wp_maybe_auto_update' ); 
     569    if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) { 
     570        // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site. 
     571        $next = strtotime( 'today 7am' ); 
     572        $now = time(); 
     573        // Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now. 
     574        while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) { 
     575            $next += 12 * HOUR_IN_SECONDS; 
     576        } 
     577        $next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; 
     578        wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' ); 
     579    } 
    571580} 
    572581 
  • trunk/src/wp-includes/version.php

    r25801 r25825  
    1212 * @global int $wp_db_version 
    1313 */ 
    14 $wp_db_version = 25448; 
     14$wp_db_version = 25824; 
    1515 
    1616/** 
Note: See TracChangeset for help on using the changeset viewer.