From ea46c7423aff74f33ba64eb4e61e17fbf036e766 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 7 Jul 2014 18:06:15 +0000 Subject: [PATCH] Correct the usage of the variable passed to `wp_install_download_language_pack()` and kill an unused local variable. Props michalzuber. Also avoid using the `$_REQUEST` superglobal in this function. See #28577. Built from https://develop.svn.wordpress.org/trunk@29016 git-svn-id: http://core.svn.wordpress.org/trunk@28804 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 6e4fd801fa..cc573b4ef7 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -2210,11 +2210,17 @@ function wp_get_available_translations() { return false; } -function wp_install_download_language_pack( $language ) { +/** + * [wp_install_download_language_pack description] + * + * @param string $lang [description] + * @return string|false [description] + */ +function wp_install_download_language_pack( $lang ) { // Check if the language is already installed. $available_languages = get_available_languages(); - if ( in_array( $language->language, $available_languages ) ) { - return $language->language; + if ( in_array( $lang, $available_languages ) ) { + return $lang; } // Confirm the language is one we can download. @@ -2222,8 +2228,8 @@ function wp_install_download_language_pack( $language ) { $loading_language = false; if ( $body ) { foreach ( $body['languages'] as $language ) { - if ( $language['language'] === $_REQUEST['language'] ) { - $loading_language = $_REQUEST['language']; + if ( $language['language'] === $lang ) { + $loading_language = $lang; break; } } @@ -2237,7 +2243,6 @@ function wp_install_download_language_pack( $language ) { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $skin = new Automatic_Upgrader_Skin; $upgrader = new Language_Pack_Upgrader( $skin ); - $options = array( 'clear_update_cache' => false ); $language->type = 'core'; /** * @todo failures (such as non-direct FS)