From 283843ddb1d5abd3b3f3d6e485bb6e0db8c3c192 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 17 Feb 2009 00:13:25 +0000 Subject: [PATCH] Check for new version when visiting Tools->Upgrade. fixes #9108 git-svn-id: https://develop.svn.wordpress.org/trunk@10583 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/update-core.php | 1 + wp-includes/update.php | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index 258400990d..ab8cd0242b 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -203,6 +203,7 @@ function do_undismiss_core_update() { $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; if ( 'upgrade-core' == $action ) { + wp_version_check(); $title = __('Upgrade WordPress'); $parent_file = 'tools.php'; require_once('admin-header.php'); diff --git a/wp-includes/update.php b/wp-includes/update.php index e6713da058..a02a579850 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -31,12 +31,6 @@ function wp_version_check() { $current = new stdClass; $locale = get_locale(); - if ( - isset( $current->last_checked ) && - 43200 > ( time() - $current->last_checked ) && - $current->version_checked == $wp_version - ) - return false; // Update last_checked for current to prevent multiple blocking requests if request hangs $current->last_checked = time(); @@ -86,7 +80,6 @@ function wp_version_check() { $updates->version_checked = $wp_version; set_transient( 'update_core', $updates); } -add_action( 'init', 'wp_version_check' ); /** * Check plugin versions against the latest versions hosted on WordPress.org. @@ -243,6 +236,18 @@ function wp_update_themes( ) { set_transient( 'update_themes', $new_option ); } +function _maybe_update_core() { + global $wp_version; + + $current = get_transient( 'update_core' ); + + if ( isset( $current->last_checked ) && + 43200 > ( time() - $current->last_checked ) && + $current->version_checked == $wp_version ) + return; + + wp_version_check(); +} /** * Check the last time plugins were run before checking plugin versions. * @@ -277,6 +282,8 @@ function _maybe_update_themes( ) { wp_update_themes( ); } +add_action( 'init', '_maybe_update_core' ); + add_action( 'load-plugins.php', 'wp_update_plugins' ); add_action( 'load-update.php', 'wp_update_plugins' ); add_action( 'admin_init', '_maybe_update_plugins' );