From 64686e25157df2269740c160f2a6aa38d2b8ae19 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 1 Apr 2011 09:13:50 +0000 Subject: [PATCH] Back-compat for upgrades with WP_LANG_DIR. See #11495 git-svn-id: https://develop.svn.wordpress.org/trunk@17578 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/update-core.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index df7c499477..64521b9a18 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -368,14 +368,20 @@ function update_core($from, $to) { // Custom Content Directory needs updating now. // Copy Languages if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) { - if ( !@is_dir(WP_LANG_DIR) && 0 === strpos(WP_LANG_DIR, ABSPATH) ) { // Check the language directory exists first - $wp_filesystem->mkdir($to . str_replace(WP_LANG_DIR, ABSPATH, ''), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. + if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) ) + $lang_dir = WP_LANG_DIR; + else + $lang_dir = WP_CONTENT_DIR . '/languages'; + + if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first + $wp_filesystem->mkdir($to . str_replace($lang_dir, ABSPATH, ''), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. clearstatcache(); // for FTP, Need to clear the stat cache } - if ( @is_dir(WP_LANG_DIR) ) { - $wp_lang_dir = $wp_filesystem->wp_lang_dir(); - $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir); + if ( @is_dir($lang_dir) ) { + $wp_lang_dir = $wp_filesystem->find_folder($lang_dir); + if ( $wp_lang_dir ) + $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir); } }