Ticket #27365: 27365.2.diff
File 27365.2.diff, 3.1 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-wp-upgrader.php
class WP_Upgrader { 635 635 * @type bool $abort_if_destination_exists Abort if the Destination directory exists. 636 636 * @type bool $is_multi Whether the upgrader is running multiple times. 637 637 * @type array $hook_extra Extra hook arguments. 638 638 * } 639 639 */ 640 640 $options = apply_filters( 'upgrader_package_options', $options ); 641 641 642 642 if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times 643 643 $this->skin->header(); 644 644 } 645 645 646 646 // Connect to the Filesystem first. 647 647 $res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) ); 648 648 // Mainly for non-connected filesystem. 649 649 if ( ! $res ) { 650 $this->result = $res; 650 651 if ( ! $options['is_multi'] ) { 651 652 $this->skin->footer(); 652 653 } 653 654 return false; 654 655 } 655 656 656 657 $this->skin->before(); 657 658 658 659 if ( is_wp_error($res) ) { 660 $this->result = $res; 659 661 $this->skin->error($res); 660 662 $this->skin->after(); 661 663 if ( ! $options['is_multi'] ) { 662 664 $this->skin->footer(); 663 665 } 664 666 return $res; 665 667 } 666 668 667 669 /* 668 670 * Download the package (Note, This just returns the filename 669 671 * of the file if the package is a local file) 670 672 */ 671 673 $download = $this->download_package( $options['package'] ); 672 674 if ( is_wp_error($download) ) { 675 $this->result = $download; 673 676 $this->skin->error($download); 674 677 $this->skin->after(); 675 678 if ( ! $options['is_multi'] ) { 676 679 $this->skin->footer(); 677 680 } 678 681 return $download; 679 682 } 680 683 681 684 $delete_package = ( $download != $options['package'] ); // Do not delete a "local" file 682 685 683 686 // Unzips the file into a temporary directory. 684 687 $working_dir = $this->unpack_package( $download, $delete_package ); 685 688 if ( is_wp_error($working_dir) ) { 689 $this->result = $working_dir; 686 690 $this->skin->error($working_dir); 687 691 $this->skin->after(); 688 692 if ( ! $options['is_multi'] ) { 689 693 $this->skin->footer(); 690 694 } 691 695 return $working_dir; 692 696 } 693 697 694 698 // With the given options, this installs it to the destination directory. 695 699 $result = $this->install_package( array( 696 700 'source' => $working_dir, 697 701 'destination' => $options['destination'], 698 702 'clear_destination' => $options['clear_destination'], 699 703 'abort_if_destination_exists' => $options['abort_if_destination_exists'], 700 704 'clear_working' => $options['clear_working'], 701 705 'hook_extra' => $options['hook_extra'] 702 706 ) ); 703 707 704 708 $this->skin->set_result($result); 705 709 if ( is_wp_error($result) ) { 710 $this->result = $result; 706 711 $this->skin->error($result); 707 712 $this->skin->feedback('process_failed'); 708 713 } else { 709 714 // Install succeeded. 710 715 $this->skin->feedback('process_success'); 711 716 } 712 717 713 718 $this->skin->after(); 714 719 715 720 if ( ! $options['is_multi'] ) { 716 721 717 722 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ 718 723 do_action( 'upgrader_process_complete', $this, $options['hook_extra'] ); 719 724 $this->skin->footer(); 720 725 }