Ticket #17703: 17703.diff
File 17703.diff, 8.5 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/class-wp-upgrader.php
324 324 } else { 325 325 //Install Suceeded 326 326 $this->skin->feedback('process_success'); 327 $updated = array(); 328 if ( isset( $updating ) ) 329 $updated[$updating] = 1; 330 echo '<script type="text/javascript">(window.parent || window).updateUpdateCounts(' . json_encode( wp_get_update_data($updated) ) . ');</script>'; 327 331 } 328 332 $this->skin->after(); 329 333 … … 432 436 'clear_working' => true, 433 437 'hook_extra' => array( 434 438 'plugin' => $plugin 435 ) 439 ), 440 'updating' => 'plugins' 436 441 )); 437 442 438 443 // Cleanup our hooks, incase something else does a upgrade on this connection. … … 679 684 'clear_working' => true, 680 685 'hook_extra' => array( 681 686 'theme' => $theme 682 ) 687 ), 688 'updating' => 'themes' 683 689 ); 684 690 685 691 $this->run($options); … … 1073 1079 class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 1074 1080 var $in_loop = false; 1075 1081 var $error = false; 1082 var $updated = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0 ); 1076 1083 1077 1084 function __construct($args = array()) { 1078 1085 $defaults = array( 'url' => '', 'nonce' => '' ); … … 1146 1153 $this->flush_output(); 1147 1154 } 1148 1155 1149 function after($title = '' ) {1156 function after($title = '', $updating = 'plugins') { 1150 1157 echo '</p></div>'; 1151 1158 if ( $this->error || ! $this->result ) { 1152 1159 if ( $this->error ) … … 1158 1165 } 1159 1166 if ( !empty($this->result) && !is_wp_error($this->result) ) { 1160 1167 echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>'; 1161 echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>'; 1168 $this->updated[$updating] ++; 1169 echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide(); (window.parent || window).updateUpdateCounts(' . json_encode( wp_get_update_data($this->updated) ) . ');</script>'; 1162 1170 } 1163 1171 1164 1172 $this->reset(); … … 1225 1233 } 1226 1234 1227 1235 function after() { 1228 parent::after($this->theme_info['Name'] );1236 parent::after($this->theme_info['Name'], 'themes'); 1229 1237 } 1230 1238 function bulk_footer() { 1231 1239 parent::bulk_footer(); … … 1454 1462 $this->package = $uploads['basedir'] . '/' . $this->filename; 1455 1463 } 1456 1464 } 1457 } 1458 No newline at end of file 1465 } -
wp-admin/update.php
54 54 $title = __('Update Plugin'); 55 55 $parent_file = 'plugins.php'; 56 56 $submenu_file = 'plugins.php'; 57 wp_enqueue_script( 'update' ); 57 58 require_once(ABSPATH . 'wp-admin/admin-header.php'); 58 59 59 60 $nonce = 'upgrade-plugin_' . $plugin; … … 154 155 $title = __('Update Theme'); 155 156 $parent_file = 'themes.php'; 156 157 $submenu_file = 'themes.php'; 158 wp_enqueue_script( 'update' ); 157 159 require_once(ABSPATH . 'wp-admin/admin-header.php'); 158 160 159 161 $nonce = 'upgrade-theme_' . $theme; -
wp-includes/update.php
287 287 * 288 288 * @return array 289 289 */ 290 function wp_get_update_data( ) {290 function wp_get_update_data( $updated = array() ) { 291 291 $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0 ); 292 $formatted = array(); 292 293 293 294 if ( current_user_can( 'update_plugins' ) ) { 294 295 $update_plugins = get_site_transient( 'update_plugins' ); 295 296 if ( ! empty( $update_plugins->response ) ) 296 297 $counts['plugins'] = count( $update_plugins->response ); 298 if ( ! empty( $updated['plugins'] ) && $updated['plugins'] <= $counts['plugins'] ) 299 $counts['plugins'] -= $updated['plugins']; 300 $formatted['plugins'] = number_format_i18n( $counts['plugins'] ); 297 301 } 298 302 299 303 if ( current_user_can( 'update_themes' ) ) { 300 304 $update_themes = get_site_transient( 'update_themes' ); 301 305 if ( ! empty( $update_themes->response ) ) 302 306 $counts['themes'] = count( $update_themes->response ); 307 if ( ! empty( $updated['themes'] ) && $updated['themes'] <= $counts['themes'] ) 308 $counts['themes'] -= $updated['themes']; 309 $formatted['themes'] = number_format_i18n( $counts['themes'] ); 303 310 } 304 311 305 312 if ( function_exists( 'get_core_updates' ) && current_user_can( 'update_core' ) ) { 306 313 $update_wordpress = get_core_updates( array('dismissed' => false) ); 307 314 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') ) 308 315 $counts['wordpress'] = 1; 316 if ( ! empty( $updated['wordpress'] ) ) 317 $counts['wordpress'] -= $updated['wordpress']; 309 318 } 310 319 311 320 $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress']; 321 $formatted['total'] = number_format_i18n( $counts['total'] ); 312 322 $update_title = array(); 313 323 if ( $counts['wordpress'] ) 314 324 $update_title[] = sprintf(__('%d WordPress Update'), $counts['wordpress']); … … 319 329 320 330 $update_title = ! empty( $update_title ) ? esc_attr( implode( ', ', $update_title ) ) : ''; 321 331 322 return array( 'counts' => $counts, ' title' => $update_title );332 return array( 'counts' => $counts, 'formatted' => $formatted, 'title' => $update_title ); 323 333 } 324 334 325 335 function _maybe_update_core() { … … 385 395 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); 386 396 } 387 397 388 if ( ! is_main_site() )398 if ( ! is_main_site() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) 389 399 return; 390 400 391 401 add_action( 'admin_init', '_maybe_update_core' ); -
wp-includes/script-loader.php
331 331 'error' => __('Error while saving the changes.') 332 332 ) ); 333 333 334 $scripts->add( 'update', "/wp-admin/js/update$suffix.js", array( 'jquery' ), '20110804' ); 335 334 336 $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), '20110113', 1 ); 335 337 $scripts->add_script_data( 'plugin-install', 'plugininstallL10n', array( 336 338 'plugin_information' => __('Plugin Information:'), -
wp-admin/update-core.php
402 402 $action = 'upgrade-core'; 403 403 } 404 404 405 wp_enqueue_script( 'update' ); 406 405 407 $title = __('WordPress Updates'); 406 408 $parent_file = 'tools.php'; 407 409 -
wp-admin/js/update.dev.js
1 /** 2 * Updater JS functions 3 * 4 * @version 3.3.0 5 * 6 * @package WordPress 7 * @subpackage Administration 8 */ 9 10 function updateUpdateCounts( data ) { 11 var $ = jQuery, upgradeData; 12 13 updateData = ( typeof data == 'string' ) ? $.parseJson( data ) : data; 14 15 // @todo fix parent span class count-%d values 16 $('#ab-updates, .update-count').text( updateData.formatted.total ).parent() 17 .attr( 'title', updateData.title ) 18 .addClass( 'count-' + updateData.counts.total ); 19 $('.plugin-count').text( updateData.formatted.plugins ).parent() 20 .addClass( 'count-' + updateData.counts.plugins ); 21 } 22 /** 23 * Updater JS functions 24 * 25 * @version 3.3.0 26 * 27 * @package WordPress 28 * @subpackage Administration 29 */ 30 31 function updateUpdateCounts( data ) { 32 var $ = jQuery, upgradeData; 33 34 updateData = ( typeof data == 'string' ) ? $.parseJson( data ) : data; 35 36 // @todo fix parent span class count-%d values 37 $('#ab-updates, .update-count').text( updateData.formatted.total ).parent() 38 .attr( 'title', updateData.title ) 39 .addClass( 'count-' + updateData.counts.total ); 40 $('.plugin-count').text( updateData.formatted.plugins ).parent() 41 .addClass( 'count-' + updateData.counts.plugins ); 42 } -
wp-admin/plugins.php
110 110 111 111 $title = __( 'Update Plugins' ); 112 112 $parent_file = 'plugins.php'; 113 wp_enqueue_script( 'update' ); 113 114 114 115 require_once(ABSPATH . 'wp-admin/admin-header.php'); 115 116