Role/Capability: Prevent a fatal error when checking a language capability early or in the frontend.

The meta capabilities `install_languages` and `update_languages` rely on the admin function `wp_can_install_language_pack()`. That function in turn relies on `request_filesystem_credentials()`, so it needs to be ensured that this function is available as well.

Fixes #42230.

Built from https://develop.svn.wordpress.org/trunk@41885


git-svn-id: http://core.svn.wordpress.org/trunk@41719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2017-10-16 22:54:57 +00:00
parent 3f8621b632
commit 021afced82
2 changed files with 5 additions and 1 deletions

View File

@ -432,6 +432,10 @@ function map_meta_cap( $cap, $user_id ) {
break; break;
case 'install_languages': case 'install_languages':
case 'update_languages': case 'update_languages':
if ( ! function_exists( 'request_filesystem_credentials' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
if ( ! function_exists( 'wp_can_install_language_pack' ) ) { if ( ! function_exists( 'wp_can_install_language_pack' ) ) {
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta2-41884'; $wp_version = '4.9-beta2-41885';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.