// Check if the language directory exists first.
if ( ! @
is_dir( $lang_dir ) && 0 ===
strpos( $lang_dir, ABSPATH
) ) { // If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
$wp_filesystem->
mkdir( $to .
str_replace( ABSPATH, '',
$lang_dir ), FS_CHMOD_DIR
);
clearstatcache(); // For FTP, need to clear the stat cache.
} 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 );
if ( is_wp_error( $result ) ) { $result =
new WP_Error( $result->
get_error_code() . '_languages',
$result->
get_error_message(),
substr( $result->
get_error_data(),
strlen( $wp_lang_dir ) ) );
} }