Changeset 36184 for branches/3.8
- Timestamp:
- 01/06/2016 12:23:15 PM (9 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
-
branches/3.8/src/wp-includes/update.php
r27929 r36184 155 155 $updates->translations = $body['translations']; 156 156 157 set_site_transient( 'update_core', $updates); 157 set_site_transient( 'update_core', $updates ); 158 159 if ( ! empty( $body['ttl'] ) ) { 160 $ttl = (int) $body['ttl']; 161 if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) { 162 // Queue an event to re-run the update check in $ttl seconds. 163 wp_schedule_single_event( time() + $ttl, 'wp_version_check' ); 164 } 165 } 166 167 // Trigger background updates if running non-interactively, and we weren't called from the update handler. 168 if ( defined( 'DOING_CRON' ) && DOING_CRON && 'wp_maybe_auto_update' != current_filter() ) { 169 do_action( 'wp_maybe_auto_update' ); 170 } 158 171 } 159 172 … … 206 219 break; 207 220 default : 208 $timeout = 12 * HOUR_IN_SECONDS; 221 if ( defined( 'DOING_CRON' ) && DOING_CRON ) { 222 $timeout = 0; 223 } else { 224 $timeout = 12 * HOUR_IN_SECONDS; 225 } 209 226 } 210 227 … … 353 370 break; 354 371 default : 355 $timeout = 12 * HOUR_IN_SECONDS; 372 if ( defined( 'DOING_CRON' ) && DOING_CRON ) { 373 $timeout = 0; 374 } else { 375 $timeout = 12 * HOUR_IN_SECONDS; 376 } 356 377 } 357 378 … … 594 615 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); 595 616 596 if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) { 597 // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site. 598 $next = strtotime( 'today 7am' ); 599 $now = time(); 600 // Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now. 601 while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) { 602 $next += 12 * HOUR_IN_SECONDS; 603 } 604 $next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; 605 // Add a random number of minutes, so we don't have all sites trying to update exactly on the hour 606 $next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS; 607 wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' ); 608 } 617 if ( ( wp_next_scheduled( 'wp_maybe_auto_update' ) > ( time() + HOUR_IN_SECONDS ) ) && ! defined('WP_INSTALLING') ) 618 wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); 609 619 } 610 620
Note: See TracChangeset
for help on using the changeset viewer.