Ticket #25219: 25219.2.diff
File 25219.2.diff, 7.0 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/theme.php
111 111 function theme_update_available( $theme ) { 112 112 static $themes_update; 113 113 114 if ( ! current_user_can('update_themes' ) )114 if ( ! current_user_can( 'view_theme_updates' ) ) 115 115 return; 116 116 117 117 if ( !isset($themes_update) ) -
src/wp-admin/includes/update.php
119 119 } 120 120 121 121 function core_update_footer( $msg = '' ) { 122 if ( ! current_user_can('update_core') )122 if ( ! current_user_can( 'view_core_updates' ) ) 123 123 return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); 124 124 125 125 $cur = get_preferred_from_update_core(); … … 180 180 function update_right_now_message() { 181 181 $msg = sprintf( __( 'You are using <span class="b">WordPress %s</span>.' ), get_bloginfo( 'version', 'display' ) ); 182 182 183 if ( current_user_can( 'update_core') ) {183 if ( current_user_can( 'view_core_updates' ) ) { 184 184 $cur = get_preferred_from_update_core(); 185 185 186 186 if ( isset( $cur->response ) && $cur->response == 'upgrade' ) … … 205 205 } 206 206 207 207 function wp_plugin_update_rows() { 208 if ( ! current_user_can('update_plugins' ) )208 if ( ! current_user_can( 'view_plugin_updates' ) ) 209 209 return; 210 210 211 211 $plugins = get_site_transient( 'update_plugins' ); -
src/wp-admin/menu.php
34 34 $update_data = wp_get_update_data(); 35 35 36 36 if ( ! is_multisite() ) { 37 if ( current_user_can( ' update_core' ) )38 $cap = ' update_core';39 elseif ( current_user_can( ' update_plugins' ) )40 $cap = ' update_plugins';37 if ( current_user_can( 'view_core_updates' ) ) 38 $cap = 'view_core_updates'; 39 elseif ( current_user_can( 'view_plugin_updates' ) ) 40 $cap = 'view_plugin_updates'; 41 41 else 42 $cap = ' update_themes';42 $cap = 'view_theme_updates'; 43 43 $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php'); 44 44 unset( $cap ); 45 45 } … … 155 155 } 156 156 157 157 $count = ''; 158 if ( ! is_multisite() && current_user_can( ' update_plugins' ) ) {158 if ( ! is_multisite() && current_user_can( 'view_plugin_updates' ) ) { 159 159 if ( ! isset( $update_data ) ) 160 160 $update_data = wp_get_update_data(); 161 161 $count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>"; -
src/wp-admin/update-core.php
18 18 exit(); 19 19 } 20 20 21 if ( ! current_user_can( ' update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )21 if ( ! current_user_can( 'view_core_updates' ) && ! current_user_can( 'view_theme_updates' ) && ! current_user_can( 'view_plugin_updates' ) ) 22 22 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); 23 23 24 24 function list_core_update( $update ) { … … 457 457 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>'; 458 458 echo '</p>'; 459 459 460 if ( current_user_can( ' update_core' ) )460 if ( current_user_can( 'view_core_updates' ) ) 461 461 core_upgrade_preamble(); 462 if ( current_user_can( ' update_plugins' ) )462 if ( current_user_can( 'view_plugin_updates' ) ) 463 463 list_plugin_updates(); 464 if ( current_user_can( ' update_themes' ) )464 if ( current_user_can( 'view_theme_updates' ) ) 465 465 list_theme_updates(); 466 466 do_action('core_upgrade_preamble'); 467 467 echo '</div>'; … … 469 469 470 470 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { 471 471 472 if ( ! current_user_can( ' update_core' ) )472 if ( ! current_user_can( 'view_core_updates' ) ) 473 473 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); 474 474 475 475 check_admin_referer('upgrade-core'); … … 494 494 495 495 } elseif ( 'do-plugin-upgrade' == $action ) { 496 496 497 if ( ! current_user_can( ' update_plugins' ) )497 if ( ! current_user_can( 'view_plugin_updates' ) ) 498 498 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); 499 499 500 500 check_admin_referer('upgrade-core'); … … 523 523 524 524 } elseif ( 'do-theme-upgrade' == $action ) { 525 525 526 if ( ! current_user_can( ' update_themes' ) )526 if ( ! current_user_can( 'view_theme_updates' ) ) 527 527 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); 528 528 529 529 check_admin_referer('upgrade-core'); -
src/wp-includes/capabilities.php
1221 1221 else 1222 1222 $caps[] = $cap; 1223 1223 break; 1224 case 'view_plugin_updates': 1225 case 'view_theme_updates': 1226 case 'view_core_updates': 1227 if ( is_multisite() && ! is_super_admin( $user_id ) ) 1228 $caps[] = 'do_not_allow'; 1229 else 1230 $caps[] = 'manage_options'; 1231 break; 1224 1232 case 'activate_plugins': 1225 1233 $caps[] = $cap; 1226 1234 if ( is_multisite() ) { -
src/wp-includes/update.php
358 358 function wp_get_update_data() { 359 359 $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0 ); 360 360 361 if ( current_user_can( ' update_plugins' ) ) {361 if ( current_user_can( 'view_plugin_updates' ) ) { 362 362 $update_plugins = get_site_transient( 'update_plugins' ); 363 363 if ( ! empty( $update_plugins->response ) ) 364 364 $counts['plugins'] = count( $update_plugins->response ); 365 365 } 366 366 367 if ( current_user_can( ' update_themes' ) ) {367 if ( current_user_can( 'view_theme_updates' ) ) { 368 368 $update_themes = get_site_transient( 'update_themes' ); 369 369 if ( ! empty( $update_themes->response ) ) 370 370 $counts['themes'] = count( $update_themes->response ); 371 371 } 372 372 373 if ( function_exists( 'get_core_updates' ) && current_user_can( ' update_core' ) ) {373 if ( function_exists( 'get_core_updates' ) && current_user_can( 'view_core_updates' ) ) { 374 374 $update_wordpress = get_core_updates( array('dismissed' => false) ); 375 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array( 'development', 'latest') ) && current_user_can('update_core') )375 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array( 'development', 'latest' ) ) && current_user_can( 'view_core_updates' ) ) 376 376 $counts['wordpress'] = 1; 377 377 } 378 378