Make WordPress Core


Ignore:
Timestamp:
07/14/2009 08:34:39 AM (17 years ago)
Author:
azaozz
Message:

Hide update notification for themes that are updated manually, props Denis-de-Bernardy, fixes #10220

File:
1 edited

Legend:

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

    r11585 r11714  
    202202        $time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked );
    203203
    204         if( $time_not_changed )
     204        $themes = array();
     205        $checked = array();
     206        $themes['current_theme'] = (array) $current_theme;
     207        foreach( (array) $installed_themes as $theme_title => $theme ) {
     208                $themes[$theme['Stylesheet']] = array();
     209                $checked[$theme['Stylesheet']] = $theme['Version'];
     210
     211                foreach( (array) $theme as $key => $value ) {
     212                        $themes[$theme['Stylesheet']][$key] = $value;
     213                }
     214        }
     215
     216        $theme_changed = false;
     217        foreach ( $checked as $slug => $v ) {
     218                $new_option->checked[ $slug ] = $v;
     219
     220                if ( !isset( $current_theme->checked[ $slug ] ) || strval($current_theme->checked[ $slug ]) !== strval($v) )
     221                        $theme_changed = true;
     222        }
     223
     224        if ( isset ( $current_theme->response ) && is_array( $current_theme->response ) ) {
     225                foreach ( $current_theme->response as $slug => $update_details ) {
     226                        if ( ! isset($checked[ $slug ]) ) {
     227                                $theme_changed = true;
     228                                break;
     229                        }
     230                }
     231        }
     232
     233        if( $time_not_changed && !$theme_changed )
    205234                return false;
    206235
     
    210239
    211240        $current_theme->template = get_option( 'template' );
    212 
    213         $themes = array( );
    214         $themes['current_theme'] = (array) $current_theme;
    215         foreach( (array) $installed_themes as $theme_title => $theme ) {
    216                 $themes[$theme['Stylesheet']] = array( );
    217 
    218                 foreach( (array) $theme as $key => $value ) {
    219                         $themes[$theme['Stylesheet']][$key] = $value;
    220                 }
    221         }
    222241
    223242        $options = array(
     
    236255
    237256        $response = unserialize( $raw_response['body'] );
    238         if( $response )
     257        if( $response ) {
     258                $new_option->checked = $checked;
    239259                $new_option->response = $response;
     260        }
    240261
    241262        set_transient( 'update_themes', $new_option );
Note: See TracChangeset for help on using the changeset viewer.