Schedule update checks from an init hook. see #15148

git-svn-id: http://svn.automattic.com/wordpress/trunk@15872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-10-20 16:50:57 +00:00
parent 14ae165bb5
commit 6130324d14
1 changed files with 17 additions and 8 deletions

View File

@ -334,6 +334,22 @@ function _maybe_update_themes( ) {
wp_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() ) if ( ! is_main_site() )
return; return;
@ -352,13 +368,6 @@ add_action( 'load-update-core.php', 'wp_update_themes' );
add_action( 'admin_init', '_maybe_update_themes' ); add_action( 'admin_init', '_maybe_update_themes' );
add_action( 'wp_update_themes', 'wp_update_themes' ); add_action( 'wp_update_themes', 'wp_update_themes' );
if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') ) add_action('init', 'wp_schedule_update_checks');
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');
?> ?>