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
This commit is contained in:
Dion Hulse 2011-04-01 09:13:50 +00:00
parent 69e93e978a
commit 64686e2515
1 changed files with 11 additions and 5 deletions

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