Ticket #29022: 29022.7.diff
File 29022.7.diff, 6.0 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-wp-upgrader-skins.php
111 111 return; 112 112 } 113 113 114 $updated = wp_cache_get( "{$type}_updated", 'updates' ); 115 wp_cache_set( "{$type}_updated", intval( $updated ) + 1, 'updates' ); 116 117 $update_data = wp_get_update_data(); 118 114 119 if ( defined( 'IFRAME_REQUEST' ) ) { 115 120 echo '<script type="text/javascript"> 116 121 if ( window.postMessage && JSON ) { 117 window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname );122 window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '", upgradeTitle: "' . $update_data['title'] . '" } ), window.location.protocol + "//" + window.location.hostname ); 118 123 } 119 124 </script>'; 120 125 } else { 121 126 echo '<script type="text/javascript"> 122 127 (function( wp ) { 123 128 if ( wp && wp.updates.decrementCount ) { 124 wp.updates.decrementCount( "' . $type . '" );129 wp.updates.decrementCount( "' . $type . '", "' . $update_data['title'] . '" ); 125 130 } 126 131 })( window.wp ); 127 132 </script>'; -
src/wp-admin/js/updates.js
8 8 * Decrement update counts throughout the various menus 9 9 * 10 10 * @param {string} updateType 11 * @param {string} title 11 12 */ 12 wp.updates.decrementCount = function( upgradeType ) {13 wp.updates.decrementCount = function( upgradeType, title ) { 13 14 var count, pluginCount, $elem; 14 15 15 16 $elem = $( '#wp-admin-bar-updates .ab-label' ); … … 18 19 if ( count < 0 ) { 19 20 return; 20 21 } 21 $( '#wp-admin-bar-updates .ab-item' ).removeAttr( 'title' );22 22 $elem.text( count ); 23 23 24 $( '#wp-admin-bar-updates .ab-item' ).attr( 'title', title ); 25 $( '#wp-admin-bar-updates .screen-reader-text' ).text( title ); 26 24 27 $elem = $( 'a[href="update-core.php"] .update-plugins' ); 25 28 $elem.each( function( index, elem ) { 26 29 elem.className = elem.className.replace( /count-\d+/, 'count-' + count ); … … 58 61 return; 59 62 } 60 63 61 wp.updates.decrementCount( message.upgradeType );64 wp.updates.decrementCount( message.upgradeType, message.upgradeTitle ); 62 65 63 66 } ); 64 67 -
src/wp-includes/load.php
452 452 453 453 if ( function_exists( 'wp_cache_add_global_groups' ) ) { 454 454 wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) ); 455 wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );455 wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins', 'updates' ) ); 456 456 } 457 457 } 458 458 -
src/wp-includes/update.php
522 522 523 523 if ( $plugins = current_user_can( 'update_plugins' ) ) { 524 524 $update_plugins = get_site_transient( 'update_plugins' ); 525 if ( ! empty( $update_plugins->response ) ) 525 if ( ! empty( $update_plugins->response ) ) { 526 526 $counts['plugins'] = count( $update_plugins->response ); 527 $plugins_updated = wp_cache_get( 'plugin_updated', 'updates' ); 528 if ( $plugins_updated > 0 ) { 529 $counts['plugins'] -= $plugins_updated; 530 } 531 } 527 532 } 528 533 529 534 if ( $themes = current_user_can( 'update_themes' ) ) { 530 535 $update_themes = get_site_transient( 'update_themes' ); 531 if ( ! empty( $update_themes->response ) ) 536 if ( ! empty( $update_themes->response ) ) { 532 537 $counts['themes'] = count( $update_themes->response ); 538 $themes_updated = wp_cache_get( 'theme_updated', 'updates' ); 539 if ( $themes_updated > 0 ) { 540 $counts['plugins'] -= $themes_updated; 541 } 542 } 533 543 } 534 544 535 545 if ( ( $core = current_user_can( 'update_core' ) ) && function_exists( 'get_core_updates' ) ) { 536 546 $update_wordpress = get_core_updates( array('dismissed' => false) ); 537 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') )547 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') && ! wp_cache_get( 'wordpress_updated', 'updates' ) ) 538 548 $counts['wordpress'] = 1; 539 549 } 540 550 541 if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() ) 542 $counts['translations'] = 1; 551 if ( ( $core || $plugins || $themes ) && $translations = wp_get_translation_updates() ) { 552 $counts['translations'] = count( $translations ); 553 $translations_updated = wp_cache_get( 'translation_updated', 'updates' ); 554 if ( $translations_updated > 0 ) { 555 $counts['translations'] -= $translations_updated; 556 } 557 } 543 558 544 559 $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations']; 545 560 $titles = array(); 546 if ( $counts['wordpress'] )561 if ( $counts['wordpress'] > 0 ) 547 562 $titles['wordpress'] = sprintf( __( '%d WordPress Update'), $counts['wordpress'] ); 548 if ( $counts['plugins'] )563 if ( $counts['plugins'] > 0 ) 549 564 $titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] ); 550 if ( $counts['themes'] )565 if ( $counts['themes'] > 0 ) 551 566 $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] ); 552 if ( $counts['translations'] )567 if ( $counts['translations'] > 0 ) 553 568 $titles['translations'] = __( 'Translation Updates' ); 554 569 555 570 $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : '';