Make WordPress Core

Ticket #27365: 27365.2.diff

File 27365.2.diff, 3.1 KB (added by dd32, 9 years ago)
  • src/wp-admin/includes/class-wp-upgrader.php

    class WP_Upgrader { 
    635635                 *     @type bool   $abort_if_destination_exists Abort if the Destination directory exists.
    636636                 *     @type bool   $is_multi                    Whether the upgrader is running multiple times.
    637637                 *     @type array  $hook_extra                  Extra hook arguments.
    638638                 * }
    639639                 */
    640640                $options = apply_filters( 'upgrader_package_options', $options );
    641641
    642642                if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
    643643                        $this->skin->header();
    644644                }
    645645
    646646                // Connect to the Filesystem first.
    647647                $res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
    648648                // Mainly for non-connected filesystem.
    649649                if ( ! $res ) {
     650                        $this->result = $res;
    650651                        if ( ! $options['is_multi'] ) {
    651652                                $this->skin->footer();
    652653                        }
    653654                        return false;
    654655                }
    655656
    656657                $this->skin->before();
    657658
    658659                if ( is_wp_error($res) ) {
     660                        $this->result = $res;
    659661                        $this->skin->error($res);
    660662                        $this->skin->after();
    661663                        if ( ! $options['is_multi'] ) {
    662664                                $this->skin->footer();
    663665                        }
    664666                        return $res;
    665667                }
    666668
    667669                /*
    668670                 * Download the package (Note, This just returns the filename
    669671                 * of the file if the package is a local file)
    670672                 */
    671673                $download = $this->download_package( $options['package'] );
    672674                if ( is_wp_error($download) ) {
     675                        $this->result = $download;
    673676                        $this->skin->error($download);
    674677                        $this->skin->after();
    675678                        if ( ! $options['is_multi'] ) {
    676679                                $this->skin->footer();
    677680                        }
    678681                        return $download;
    679682                }
    680683
    681684                $delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
    682685
    683686                // Unzips the file into a temporary directory.
    684687                $working_dir = $this->unpack_package( $download, $delete_package );
    685688                if ( is_wp_error($working_dir) ) {
     689                        $this->result = $working_dir;
    686690                        $this->skin->error($working_dir);
    687691                        $this->skin->after();
    688692                        if ( ! $options['is_multi'] ) {
    689693                                $this->skin->footer();
    690694                        }
    691695                        return $working_dir;
    692696                }
    693697
    694698                // With the given options, this installs it to the destination directory.
    695699                $result = $this->install_package( array(
    696700                        'source' => $working_dir,
    697701                        'destination' => $options['destination'],
    698702                        'clear_destination' => $options['clear_destination'],
    699703                        'abort_if_destination_exists' => $options['abort_if_destination_exists'],
    700704                        'clear_working' => $options['clear_working'],
    701705                        'hook_extra' => $options['hook_extra']
    702706                ) );
    703707
    704708                $this->skin->set_result($result);
    705709                if ( is_wp_error($result) ) {
     710                        $this->result = $result;
    706711                        $this->skin->error($result);
    707712                        $this->skin->feedback('process_failed');
    708713                } else {
    709714                        // Install succeeded.
    710715                        $this->skin->feedback('process_success');
    711716                }
    712717
    713718                $this->skin->after();
    714719
    715720                if ( ! $options['is_multi'] ) {
    716721
    717722                        /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
    718723                        do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
    719724                        $this->skin->footer();
    720725                }