WordPress.org

Make WordPress Core

Changeset 10515


Ignore:
Timestamp:
02/06/2009 06:06:20 PM (10 years ago)
Author:
ryan
Message:

Use transient for update_core, update_plugins, update_themes. see #9048

Location:
trunk
Files:
4 edited

Legend:

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

    r10050 r10515  
    255255
    256256    // Force refresh of update information
    257     delete_option('update_core');
     257    delete_transient('update_core');
    258258
    259259    // Remove maintenance file, we're done.
  • trunk/wp-admin/includes/update.php

    r10150 r10515  
    3434    $dismissed = get_option( 'dismissed_update_core' );
    3535    if ( !is_array( $dismissed ) ) $dismissed = array();
    36     $from_api = get_option( 'update_core' );
     36    $from_api = get_transient( 'update_core' );
    3737    if ( empty($from_api) )
    3838        return false;
     
    7272
    7373function find_core_update( $version, $locale ) {
    74     $from_api = get_option( 'update_core' );
     74    $from_api = get_transient( 'update_core' );
    7575    if ( !is_array( $from_api->updates ) ) return false;
    7676    $updates = $from_api->updates;
     
    147147
    148148function wp_plugin_update_row( $file, $plugin_data ) {
    149     $current = get_option( 'update_plugins' );
     149    $current = get_transient( 'update_plugins' );
    150150    if ( !isset( $current->response[ $file ] ) )
    151151        return false;
     
    174174
    175175    // Is an update available?
    176     $current = get_option( 'update_plugins' );
     176    $current = get_transient( 'update_plugins' );
    177177    if ( !isset( $current->response[ $plugin ] ) )
    178178        return new WP_Error('up_to_date', __('The plugin is at the latest version.'));
     
    269269
    270270    // Force refresh of plugin update information
    271     delete_option('update_plugins');
     271    delete_transient('update_plugins');
    272272
    273273    if( empty($filelist) )
  • trunk/wp-admin/menu.php

    r10403 r10515  
    5959    $submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
    6060
    61 $update_plugins = get_option( 'update_plugins' );
     61$update_plugins = get_transient( 'update_plugins' );
    6262$update_count = 0;
    6363if ( !empty($update_plugins->response) )
  • trunk/wp-includes/update.php

    r10238 r10515  
    2727    $php_version = phpversion();
    2828
    29     $current = get_option( 'update_core' );
     29    $current = get_transient( 'update_core' );
    3030    if ( ! is_object($current) )
    3131        $current = new stdClass;
     
    4141    // Update last_checked for current to prevent multiple blocking requests if request hangs
    4242    $current->last_checked = time();
    43     update_option( 'update_core', $current );
     43    set_transient( 'update_core', $current );
    4444
    4545    if ( method_exists( $wpdb, 'db_version' ) )
     
    8585    $updates->last_checked = time();
    8686    $updates->version_checked = $wp_version;
    87     update_option( 'update_core',  $updates);
     87    set_transient( 'update_core',  $updates);
    8888}
    8989add_action( 'init', 'wp_version_check' );
     
    114114    $plugins = get_plugins();
    115115    $active  = get_option( 'active_plugins' );
    116     $current = get_option( 'update_plugins' );
     116    $current = get_transient( 'update_plugins' );
    117117    if ( ! is_object($current) )
    118118        $current = new stdClass;
     
    146146    // Update last_checked for current to prevent multiple blocking requests if request hangs
    147147    $current->last_checked = time();
    148     update_option( 'update_plugins', $current );
     148    set_transient( 'update_plugins', $current );
    149149
    150150    $to_send = (object)compact('plugins', 'active');
     
    171171        $new_option->response = array();
    172172
    173     update_option( 'update_plugins', $new_option );
     173    set_transient( 'update_plugins', $new_option );
    174174}
    175175
     
    197197
    198198    $installed_themes = get_themes( );
    199     $current_theme = get_option( 'update_themes' );
     199    $current_theme = get_transient( 'update_themes' );
    200200    if ( ! is_object($current_theme) )
    201201        $current_theme = new stdClass;
     
    211211    // Update last_checked for current to prevent multiple blocking requests if request hangs
    212212    $current_theme->last_checked = time();
    213     update_option( 'update_themes', $current_theme );
     213    set_transient( 'update_themes', $current_theme );
    214214
    215215    $themes = array( );
     
    241241        $new_option->response = $response;
    242242
    243     update_option( 'update_themes', $new_option );
     243    set_transient( 'update_themes', $new_option );
    244244}
    245245
     
    255255 */
    256256function _maybe_update_plugins() {
    257     $current = get_option( 'update_plugins' );
     257    $current = get_transient( 'update_plugins' );
    258258    if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
    259259        return;
     
    271271 */
    272272function _maybe_update_themes( ) {
    273     $current = get_option( 'update_themes' );
     273    $current = get_transient( 'update_themes' );
    274274    if( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
    275275        return;
Note: See TracChangeset for help on using the changeset viewer.