Make WordPress Core


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.