Hide update notification for themes that are updated manually, props Denis-de-Bernardy, fixes #10220
git-svn-id: https://develop.svn.wordpress.org/trunk@11714 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3cd210f180
commit
a8855d1e60
|
@ -201,7 +201,36 @@ function wp_update_themes( ) {
|
||||||
$timeout = 'load-themes.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
|
$timeout = 'load-themes.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
|
||||||
$time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked );
|
$time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked );
|
||||||
|
|
||||||
if( $time_not_changed )
|
$themes = array();
|
||||||
|
$checked = array();
|
||||||
|
$themes['current_theme'] = (array) $current_theme;
|
||||||
|
foreach( (array) $installed_themes as $theme_title => $theme ) {
|
||||||
|
$themes[$theme['Stylesheet']] = array();
|
||||||
|
$checked[$theme['Stylesheet']] = $theme['Version'];
|
||||||
|
|
||||||
|
foreach( (array) $theme as $key => $value ) {
|
||||||
|
$themes[$theme['Stylesheet']][$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$theme_changed = false;
|
||||||
|
foreach ( $checked as $slug => $v ) {
|
||||||
|
$new_option->checked[ $slug ] = $v;
|
||||||
|
|
||||||
|
if ( !isset( $current_theme->checked[ $slug ] ) || strval($current_theme->checked[ $slug ]) !== strval($v) )
|
||||||
|
$theme_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset ( $current_theme->response ) && is_array( $current_theme->response ) ) {
|
||||||
|
foreach ( $current_theme->response as $slug => $update_details ) {
|
||||||
|
if ( ! isset($checked[ $slug ]) ) {
|
||||||
|
$theme_changed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $time_not_changed && !$theme_changed )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Update last_checked for current to prevent multiple blocking requests if request hangs
|
// Update last_checked for current to prevent multiple blocking requests if request hangs
|
||||||
|
@ -210,16 +239,6 @@ function wp_update_themes( ) {
|
||||||
|
|
||||||
$current_theme->template = get_option( 'template' );
|
$current_theme->template = get_option( 'template' );
|
||||||
|
|
||||||
$themes = array( );
|
|
||||||
$themes['current_theme'] = (array) $current_theme;
|
|
||||||
foreach( (array) $installed_themes as $theme_title => $theme ) {
|
|
||||||
$themes[$theme['Stylesheet']] = array( );
|
|
||||||
|
|
||||||
foreach( (array) $theme as $key => $value ) {
|
|
||||||
$themes[$theme['Stylesheet']][$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
'timeout' => 3,
|
'timeout' => 3,
|
||||||
'body' => array( 'themes' => serialize( $themes ) ),
|
'body' => array( 'themes' => serialize( $themes ) ),
|
||||||
|
@ -235,8 +254,10 @@ function wp_update_themes( ) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$response = unserialize( $raw_response['body'] );
|
$response = unserialize( $raw_response['body'] );
|
||||||
if( $response )
|
if( $response ) {
|
||||||
|
$new_option->checked = $checked;
|
||||||
$new_option->response = $response;
|
$new_option->response = $response;
|
||||||
|
}
|
||||||
|
|
||||||
set_transient( 'update_themes', $new_option );
|
set_transient( 'update_themes', $new_option );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue