WordPress.org

Make WordPress Core

Ticket #22840: 22840.diff

File 22840.diff, 3.8 KB (added by dd32, 7 years ago)
  • src/wp-admin/includes/class-wp-upgrader.php

     
    424424
    425425                add_filter('upgrader_source_selection', array($this, 'check_package') );
    426426
    427                 $this->run( array(
     427                $run_result = $this->run( array(
    428428                        'package' => $package,
    429429                        'destination' => WP_PLUGIN_DIR,
    430430                        'clear_destination' => false, // Do not overwrite files.
     
    434434
    435435                remove_filter('upgrader_source_selection', array($this, 'check_package') );
    436436
     437                if ( ! $run_result || is_wp_error( $run_result ) )
     438                        return $run_result;
     439
    437440                if ( ! $this->result || is_wp_error($this->result) )
    438441                        return $this->result;
    439442
     
    471474                add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4);
    472475                //'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
    473476
    474                 $this->run( array(
     477                $run_result = $this->run( array(
    475478                        'package' => $r->package,
    476479                        'destination' => WP_PLUGIN_DIR,
    477480                        'clear_destination' => true,
     
    485488                remove_filter('upgrader_pre_install', array($this, 'deactivate_plugin_before_upgrade'));
    486489                remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'));
    487490
     491                if ( ! $run_result || is_wp_error( $run_result ) )
     492                        return $run_result;
     493
    488494                if ( ! $this->result || is_wp_error($this->result) )
    489495                        return $this->result;
    490496
     
    797803                add_filter('upgrader_source_selection', array($this, 'check_package') );
    798804                add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
    799805
    800                 $this->run( array(
     806                $run_result = $this->run( array(
    801807                        'package' => $package,
    802808                        'destination' => get_theme_root(),
    803809                        'clear_destination' => false, //Do not overwrite files.
     
    807813                remove_filter('upgrader_source_selection', array($this, 'check_package') );
    808814                remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'));
    809815
     816                if ( ! $run_result || is_wp_error( $run_result ) )
     817                        return $run_result;
     818
    810819                if ( ! $this->result || is_wp_error($this->result) )
    811820                        return $this->result;
    812821
     
    844853                add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
    845854                add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
    846855
    847                 $this->run( array(
     856                $run_result = $this->run( array(
    848857                        'package' => $r['package'],
    849858                        'destination' => get_theme_root( $theme ),
    850859                        'clear_destination' => true,
     
    858867                remove_filter('upgrader_post_install', array($this, 'current_after'));
    859868                remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
    860869
     870                if ( ! $run_result || is_wp_error( $run_result ) )
     871                        return $run_result;
     872
    861873                if ( ! $this->result || is_wp_error($this->result) )
    862874                        return $this->result;
    863875
  • src/wp-admin/update.php

     
    140140                $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
    141141                $result = $upgrader->install( $file_upload->package );
    142142
    143                 if ( $result || is_wp_error($result) )
     143                if ( false !== $result )
    144144                        $file_upload->cleanup();
    145145
    146146                include(ABSPATH . 'wp-admin/admin-footer.php');
     
    246246                $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
    247247                $result = $upgrader->install( $file_upload->package );
    248248
    249                 if ( $result || is_wp_error($result) )
     249                if ( false !== $result )
    250250                        $file_upload->cleanup();
    251251
    252252                include(ABSPATH . 'wp-admin/admin-footer.php');