Check for new version when visiting Tools->Upgrade. fixes #9108

git-svn-id: http://svn.automattic.com/wordpress/trunk@10583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-02-17 00:13:25 +00:00
parent 748b4d67a2
commit f05146c34f
2 changed files with 15 additions and 7 deletions

View File

@ -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');

View File

@ -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' );