Ticket #20974: 20974.diff
File 20974.diff, 5.0 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/class-wp-upgrader.php
1055 1055 if ( is_wp_error($working_dir) ) 1056 1056 return $working_dir; 1057 1057 1058 // Copy update-core.php from the new version into place.1058 /* // Copy update-core.php from the new version into place. 1059 1059 if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) { 1060 1060 $wp_filesystem->delete($working_dir, true); 1061 1061 return new WP_Error('copy_failed', $this->strings['copy_failed']); 1062 1062 } 1063 1063 $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE); 1064 1064 */ 1065 1065 require(ABSPATH . 'wp-admin/includes/update-core.php'); 1066 1066 1067 1067 if ( ! function_exists( 'update_core' ) ) -
wp-admin/includes/update-core.php
398 398 ); 399 399 400 400 /** 401 * Stores locale files to be deleted. 402 * 403 * @since 3.5.0 404 * @global array $_old_locale_files 405 * @var array 406 * @name $_old_locale_files 407 */ 408 global $_old_locale_files; 409 410 $_old_locale_files = array( 411 // 3.4 412 'sv_SE.php', 413 'pl_PL.php', 414 'ar.php', 415 'id_ID.php', 416 'nb_NO.php', 417 'fi.php', 418 'en_CA.php', 419 'nn_NO.php', 420 'eo.php', 421 'ckb.php', 422 'pt_BR.php', 423 ); 424 425 /** 401 426 * Stores new files in wp-content to copy 402 427 * 403 428 * The contents of this array indicate any new bundled plugins/themes which … … 469 494 * @return WP_Error|null WP_Error on failure, null on success. 470 495 */ 471 496 function update_core($from, $to) { 472 global $wp_filesystem, $_old_files, $_ new_bundled_files, $wpdb;497 global $wp_filesystem, $_old_files, $_old_locale_files, $_new_bundled_files, $wpdb; 473 498 474 499 @set_time_limit( 300 ); 475 500 … … 518 543 $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); 519 544 520 545 // Copy new versions of WP files into place. 521 $result = _copy_dir($from . $distro, $to, array('wp-content') );546 $result = true; // @DEBUG _copy_dir($from . $distro, $to, array('wp-content') ); 522 547 523 548 // Custom Content Directory needs updating now. 524 549 // Copy Languages 525 if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages')) {550 if ( !is_wp_error($result) ) { 526 551 if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) ) 527 552 $lang_dir = WP_LANG_DIR; 528 553 else 529 554 $lang_dir = WP_CONTENT_DIR . '/languages'; 555 556 if ( $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) { 557 if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first 558 $wp_filesystem->mkdir($to . str_replace(ABSPATH, '', $lang_dir), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. 559 clearstatcache(); // for FTP, Need to clear the stat cache 560 } 530 561 531 if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first 532 $wp_filesystem->mkdir($to . str_replace(ABSPATH, '', $lang_dir), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. 533 clearstatcache(); // for FTP, Need to clear the stat cache 562 if ( @is_dir($lang_dir) ) { 563 $wp_lang_dir = $wp_filesystem->find_folder($lang_dir); 564 if ( $wp_lang_dir ) 565 $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir); 566 } 567 } elseif ( @is_dir( $lang_dir ) ) { 568 $wp_lang_dir = $wp_filesystem->find_folder( $lang_dir ); 534 569 } 535 536 if ( @is_dir($lang_dir) ) {537 $wp_lang_dir = $wp_filesystem->find_folder($lang_dir);538 if ( $wp_lang_dir )539 $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir);540 }541 570 } 542 571 543 572 // Copy New bundled plugins & themes 544 573 // This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue. 545 if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {574 if ( false ) { // @DEBUG !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) { 546 575 $old_version = $GLOBALS['wp_version']; // $wp_version in local scope == new version 547 576 foreach ( (array) $_new_bundled_files as $file => $introduced_version ) { 548 577 // If $introduced version is greater than what the site was previously running … … 591 620 $wp_filesystem->delete($old_file, true); 592 621 } 593 622 623 if ( ! empty( $wp_lang_dir ) ) { 624 foreach ( $_old_locale_files as $old_file ) { 625 $old_file = $wp_lang_dir . $old_file; 626 if ( ! $wp_filesystem->exists( $old_file ) ) 627 continue; 628 $wp_filesystem->delete( $old_file, true ); 629 } 630 } 631 594 632 // Upgrade DB with separate request 595 633 apply_filters('update_feedback', __('Upgrading database…')); 596 634 $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');