From 6130324d146895013761456524ae382a56739754 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 20 Oct 2010 16:50:57 +0000 Subject: [PATCH] Schedule update checks from an init hook. see #15148 git-svn-id: http://svn.automattic.com/wordpress/trunk@15872 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/update.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/wp-includes/update.php b/wp-includes/update.php index b27b31793..51fbe7e7c 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -334,6 +334,22 @@ function _maybe_update_themes( ) { wp_update_themes(); } +/** + * Schedule core, theme, and plugin update checks. + * + * @since 3.1.0 + */ +function wp_schedule_update_checks() { + if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); + + if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); + + if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); +} + if ( ! is_main_site() ) return; @@ -352,13 +368,6 @@ add_action( 'load-update-core.php', 'wp_update_themes' ); add_action( 'admin_init', '_maybe_update_themes' ); add_action( 'wp_update_themes', 'wp_update_themes' ); -if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') ) - wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); - -if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') ) - wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); - -if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') ) - wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); +add_action('init', 'wp_schedule_update_checks'); ?>