Back-compat for upgrades with WP_LANG_DIR. See #11495

git-svn-id: http://svn.automattic.com/wordpress/trunk@17578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2011-04-01 09:13:50 +00:00
parent 4a7cdbc0d7
commit e16755db0d

View File

@ -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);
}
}