Changeset 36184 for branches/3.7/src/wp-includes/update.php
- Timestamp:
- 01/06/2016 12:23:15 PM (9 years ago)
- Location:
- branches/3.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.7
-
branches/3.7/src
- Property svn:mergeinfo changed
/trunk/src merged: 28129
- Property svn:mergeinfo changed
-
branches/3.7/src/wp-includes/update.php
r27930 r36184 147 147 $updates->translations = $body['translations']; 148 148 149 set_site_transient( 'update_core', $updates); 149 set_site_transient( 'update_core', $updates ); 150 151 if ( ! empty( $body['ttl'] ) ) { 152 $ttl = (int) $body['ttl']; 153 if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) { 154 // Queue an event to re-run the update check in $ttl seconds. 155 wp_schedule_single_event( time() + $ttl, 'wp_version_check' ); 156 } 157 } 158 159 // Trigger background updates if running non-interactively, and we weren't called from the update handler. 160 if ( defined( 'DOING_CRON' ) && DOING_CRON && 'wp_maybe_auto_update' != current_filter() ) { 161 do_action( 'wp_maybe_auto_update' ); 162 } 150 163 } 151 164 … … 198 211 break; 199 212 default : 200 $timeout = 12 * HOUR_IN_SECONDS; 213 if ( defined( 'DOING_CRON' ) && DOING_CRON ) { 214 $timeout = 0; 215 } else { 216 $timeout = 12 * HOUR_IN_SECONDS; 217 } 201 218 } 202 219 … … 345 362 break; 346 363 default : 347 $timeout = 12 * HOUR_IN_SECONDS; 364 if ( defined( 'DOING_CRON' ) && DOING_CRON ) { 365 $timeout = 0; 366 } else { 367 $timeout = 12 * HOUR_IN_SECONDS; 368 } 348 369 } 349 370 … … 586 607 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); 587 608 588 if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) { 589 // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site. 590 $next = strtotime( 'today 7am' ); 591 $now = time(); 592 // Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now. 593 while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) { 594 $next += 12 * HOUR_IN_SECONDS; 595 } 596 $next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; 597 // Add a random number of minutes, so we don't have all sites trying to update exactly on the hour 598 $next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS; 599 wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' ); 600 } 609 if ( ( wp_next_scheduled( 'wp_maybe_auto_update' ) > ( time() + HOUR_IN_SECONDS ) ) && ! defined('WP_INSTALLING') ) 610 wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); 601 611 } 602 612
Note: See TracChangeset
for help on using the changeset viewer.