From 386694bb79062e1e10d6a1dd5e88074cae04263c Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 20 Oct 2010 16:50:57 +0000 Subject: [PATCH] Schedule update checks from an init hook. see #15148 git-svn-id: https://develop.svn.wordpress.org/trunk@15872 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 b27b317931..51fbe7e7cb 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'); ?>