Ticket #39677: 39677.diff
File 39677.diff, 7.3 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/schema.php
621 621 populate_roles_270(); 622 622 populate_roles_280(); 623 623 populate_roles_300(); 624 populate_roles_480(); 624 625 } 625 626 626 627 /** … … 861 862 } 862 863 } 863 864 865 /** 866 * Create and modify WordPress roles for WordPress 4.8. 867 * 868 * @since 4.8.0 869 */ 870 function populate_roles_480() { 871 $role = get_role( 'administrator' ); 872 873 if ( !empty( $role ) ) { 874 $role->add_cap( 'install_translations' ); 875 $role->add_cap( 'update_translations' ); 876 } 877 } 878 864 879 if ( !function_exists( 'install_network' ) ) : 865 880 /** 866 881 * Install Network. -
src/wp-admin/network/settings.php
63 63 ); 64 64 65 65 // Handle translation install. 66 if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { // @todo: Skip if already installed66 if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_translations' ) && wp_can_install_language_pack() ) { // @todo: Skip if already installed 67 67 $language = wp_download_language_pack( $_POST['WPLANG'] ); 68 68 if ( $language ) { 69 69 $_POST['WPLANG'] = $language; … … 342 342 'selected' => $lang, 343 343 'languages' => $languages, 344 344 'translations' => $translations, 345 'show_available_translations' => wp_can_install_language_pack(),345 'show_available_translations' => current_user_can( 'install_translations' ) && wp_can_install_language_pack(), 346 346 ) ); 347 347 ?> 348 348 </td> -
src/wp-admin/network/site-new.php
65 65 if ( isset( $_POST['WPLANG'] ) ) { 66 66 if ( '' === $_POST['WPLANG'] ) { 67 67 $meta['WPLANG'] = ''; // en_US 68 } elseif ( wp_can_install_language_pack() ) {68 } elseif ( current_user_can( 'install_translations' ) && wp_can_install_language_pack() ) { 69 69 $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); 70 70 if ( $language ) { 71 71 $meta['WPLANG'] = $language; … … 233 233 'selected' => $lang, 234 234 'languages' => $languages, 235 235 'translations' => $translations, 236 'show_available_translations' => wp_can_install_language_pack(),236 'show_available_translations' => current_user_can( 'install_translations' ) && wp_can_install_language_pack(), 237 237 ) ); 238 238 ?> 239 239 </td> -
src/wp-admin/options-general.php
144 144 'selected' => $locale, 145 145 'languages' => $languages, 146 146 'translations' => $translations, 147 'show_available_translations' => ( ! is_multisite() || is_super_admin()) && wp_can_install_language_pack(),147 'show_available_translations' => current_user_can( 'install_translations' ) && wp_can_install_language_pack(), 148 148 ) ); 149 149 150 150 // Add note about deprecated WPLANG constant. -
src/wp-admin/options.php
182 182 } 183 183 184 184 // Handle translation install. 185 if ( ! empty( $_POST['WPLANG'] ) && ( ! is_multisite() || is_super_admin()) ) { // @todo: Skip if already installed185 if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_translations' ) ) { // @todo: Skip if already installed 186 186 require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); 187 187 188 188 if ( wp_can_install_language_pack() ) { -
src/wp-admin/update-core.php
608 608 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; 609 609 echo '</p>'; 610 610 611 if ( $core = current_user_can( 'update_core' ) )611 if ( current_user_can( 'update_core' ) ) { 612 612 core_upgrade_preamble(); 613 if ( $plugins = current_user_can( 'update_plugins' ) ) 613 } 614 if ( current_user_can( 'update_plugins' ) ) { 614 615 list_plugin_updates(); 615 if ( $themes = current_user_can( 'update_themes' ) ) 616 } 617 if ( current_user_can( 'update_themes' ) ) { 616 618 list_theme_updates(); 617 if ( $core || $plugins || $themes ) 619 } 620 if ( current_user_can( 'update_translations' ) ) { 618 621 list_translation_updates(); 619 unset( $core, $plugins, $themes ); 622 } 623 620 624 /** 621 625 * Fires after the core, plugin, and theme update tables. 622 626 * … … 729 733 730 734 } elseif ( 'do-translation-upgrade' == $action ) { 731 735 732 if ( ! current_user_can( 'update_ core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )736 if ( ! current_user_can( 'update_translations' ) ) 733 737 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); 734 738 735 739 check_admin_referer( 'upgrade-translations' ); -
src/wp-includes/capabilities.php
378 378 case 'install_themes': 379 379 case 'upload_themes': 380 380 case 'update_core': 381 // Disallow anything that creates, deletes, or updates core, plugin, or theme files. 381 case 'update_translations': 382 case 'install_translations': 383 // Disallow anything that creates, deletes, or updates core, plugin, theme, or translation files. 382 384 // Files in uploads are excepted. 383 385 if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { 384 386 $caps[] = 'do_not_allow'; -
tests/phpunit/tests/user/capabilities.php
84 84 'remove_users' => array( 'administrator' ), 85 85 'switch_themes' => array( 'administrator' ), 86 86 'edit_dashboard' => array( 'administrator' ), 87 'install_translations' => array( 'administrator' ), 88 'update_translations' => array( 'administrator' ), 87 89 88 90 'moderate_comments' => array( 'administrator', 'editor' ), 89 91 'manage_categories' => array( 'administrator', 'editor' ), … … 154 156 'update_core' => array(), 155 157 'update_plugins' => array(), 156 158 'update_themes' => array(), 159 'install_translations' => array(), 160 'update_translations' => array(), 157 161 158 162 'edit_theme_options' => array( 'administrator' ), 159 163 'export' => array( 'administrator' ), … … 416 420 $expected['delete_users'], 417 421 $expected['create_users'], 418 422 $expected['manage_links'], 423 $expected['install_translations'], 424 $expected['update_translations'], 419 425 // Singular object meta capabilities (where an object ID is passed) are not tested: 420 426 $expected['remove_user'], 421 427 $expected['promote_user'],