WordPress.org

Make WordPress Core

Changeset 26192


Ignore:
Timestamp:
11/15/2013 03:04:00 AM (7 years ago)
Author:
dd32
Message:

Updates: Force an update check to occur when the 'Check Again' button is used in the Dashboard. Fixes #25831

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r26113 r26192  
    484484
    485485if ( 'upgrade-core' == $action ) {
    486 
    487     wp_version_check();
     486    // Force a update check when requested
     487    $force_check = ! empty( $_GET['force-check'] );
     488    wp_version_check( array(), $force_check );
     489
    488490    require_once(ABSPATH . 'wp-admin/admin-header.php');
    489491    ?>
     
    504506    /* translators: %1 date, %2 time. */
    505507    printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) );
    506     echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>';
     508    echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
    507509    echo '</p>';
    508510
  • trunk/src/wp-includes/update.php

    r26188 r26192  
    1919 *
    2020 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
     21 * @param bool $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
    2122 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
    2223 */
    23 function wp_version_check( $extra_stats = array() ) {
     24function wp_version_check( $extra_stats = array(), $force_check = false ) {
    2425    if ( defined('WP_INSTALLING') )
    2526        return;
     
    4243    }
    4344
     45    if ( ! empty( $extra_stats ) )
     46        $force_check = true;
     47
    4448    // Wait 60 seconds between multiple version check requests
    4549    $timeout = 60;
    4650    $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
    47     if ( $time_not_changed && empty( $extra_stats ) )
     51    if ( ! $force_check && $time_not_changed )
    4852        return false;
    4953
     
    9599    );
    96100
    97     if ( $extra_stats )
     101    if ( is_array( $extra_stats ) )
    98102        $post_body = array_merge( $post_body, $extra_stats );
    99103
Note: See TracChangeset for help on using the changeset viewer.