From 021afced82344b48fbbc36e029df4cbb7b2c02ae Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Mon, 16 Oct 2017 22:54:57 +0000 Subject: [PATCH] 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 --- wp-includes/capabilities.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 2279c16b62..e744175c9c 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -432,6 +432,10 @@ function map_meta_cap( $cap, $user_id ) { break; case 'install_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' ) ) { require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3c2222f08e..1407a55aef 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.