Changeset 25466 for trunk/src/wp-includes/update.php
- Timestamp:
- 09/17/2013 02:25:17 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/update.php
r25442 r25466 121 121 $updates->version_checked = $wp_version; 122 122 set_site_transient( 'update_core', $updates); 123 124 wp_auto_updates_maybe_queue( 'core' );125 123 } 126 124 … … 224 222 225 223 set_site_transient( 'update_plugins', $new_option ); 226 227 wp_auto_updates_maybe_queue( 'plugins' );228 224 } 229 225 … … 336 332 337 333 set_site_transient( 'update_themes', $new_update ); 338 339 wp_auto_updates_maybe_queue( 'themes' ); 340 } 341 342 /** 343 * Queues a cron entry if a potentially upgrade is detected. 334 } 335 336 /** 337 * Cron entry which runs the WordPress Automatic Updates 344 338 * 345 339 * @since 3.7.0 346 * 347 * @param string $type The type of update to check for, may be 'core', 'plugins', or, 'themes'. 348 */ 349 function wp_auto_updates_maybe_queue( $type = 'core' ) { 350 include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php'; 351 include_once ABSPATH . '/wp-admin/includes/update.php'; 352 353 if ( WP_Automatic_Upgrader::upgrader_disabled() ) 354 return; 355 356 $updates_available = false; 357 if ( 'core' == $type ) { 358 $updates_available = (bool) find_core_auto_update(); 359 } elseif ( 'plugins' == $type ) { 360 $plugin_updates = get_site_transient( 'update_plugins' ); 361 $updates_available = !empty( $plugin_updates->response ); 362 } elseif ( 'themes' == $type ) { 363 $theme_updates = get_site_transient( 'update_themes' ); 364 $updates_available = empty( $theme_updates->response ); 365 } 366 367 if ( $updates_available && ! wp_next_scheduled( 'wp_auto_updates_execute' ) ) { 368 // If the transient update was triggered by a user pageview, update in an hours time, else, now. 369 $when_to_update = get_current_user_id() ? time() + HOUR_IN_SECONDS : time(); 370 $when_to_update = apply_filters( 'auto_upgrade_when_to_upgrade', $when_to_update ); 371 372 wp_schedule_single_event( $when_to_update, 'wp_auto_updates_execute' ); 373 } 374 375 } 376 377 function wp_auto_updates_execute() { 340 */ 341 function wp_auto_updates_maybe_update() { 378 342 include_once ABSPATH . '/wp-admin/includes/admin.php'; 379 343 include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php'; … … 488 452 if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') ) 489 453 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); 454 455 if ( !wp_next_scheduled( 'wp_auto_updates_maybe_update' ) && ! defined( 'WP_INSTALLING' ) ) 456 wp_schedule_event( time(), 'twicedaily', 'wp_auto_updates_maybe_update' ); 457 490 458 } 491 459 … … 509 477 510 478 // Automatic Updates - Cron callback 511 add_action( 'wp_auto_updates_ execute', 'wp_auto_updates_execute' );479 add_action( 'wp_auto_updates_maybe_update', 'wp_auto_updates_maybe_update' ); 512 480 513 481 add_action('init', 'wp_schedule_update_checks');
Note: See TracChangeset
for help on using the changeset viewer.