WordPress.org

Make WordPress Core

Ticket #53705: wp-upgrader-error-logging.diff

File wp-upgrader-error-logging.diff, 3.1 KB (added by bpayton, 3 months ago)

Patch WP_Upgrader to error log and show concurrent upgrade issues

  • wp-admin/includes/class-wp-upgrader.php

    diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php
    index e456191..0b48b6a 100644
    a b class WP_Upgrader { 
    253253         * @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
    254254         */
    255255        public function download_package( $package, $check_signatures = false, $hook_extra = array() ) {
     256                error_log( $_SERVER['REQUEST_URI'] . ' -- ' . __CLASS__ . '::' . __FUNCTION__ . '()' );
    256257                /**
    257258                 * Filters whether to return the package.
    258259                 *
    class WP_Upgrader { 
    302303         * @return string|WP_Error The path to the unpacked contents, or a WP_Error on failure.
    303304         */
    304305        public function unpack_package( $package, $delete_package = true ) {
     306                error_log( $_SERVER['REQUEST_URI'] . ' -- ' . __CLASS__ . '::' . __FUNCTION__ . '()' );
    305307                global $wp_filesystem;
    306308
    307309                $this->skin->feedback( 'unpack_package' );
    class WP_Upgrader { 
    312314                $upgrade_files = $wp_filesystem->dirlist( $upgrade_folder );
    313315                if ( ! empty( $upgrade_files ) ) {
    314316                        foreach ( $upgrade_files as $file ) {
     317                                error_log( $_SERVER['REQUEST_URI'] . ' -- ' . __CLASS__ . '::' . __FUNCTION__ . "() deleting '{$upgrade_folder}{$file['name']}'" );
    315318                                $wp_filesystem->delete( $upgrade_folder . $file['name'], true );
    316319                        }
    317320                }
    class WP_Upgrader { 
    450453         * @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.
    451454         */
    452455        public function install_package( $args = array() ) {
     456                error_log( $_SERVER['REQUEST_URI'] . ' -- ' . __CLASS__ . '::' . __FUNCTION__ . '()' );
    453457                global $wp_filesystem, $wp_theme_directories;
    454458
    455459                $defaults = array(
    class WP_Upgrader { 
    666670         *                              or false if unable to connect to the filesystem.
    667671         */
    668672        public function run( $options ) {
     673                error_log( $_SERVER['REQUEST_URI'] . ' -- ' . __CLASS__ . '::' . __FUNCTION__ . '()' );
    669674
    670675                $defaults = array(
    671676                        'package'                     => '', // Please always pass this.
    class WP_Upgrader { 
    765770                }
    766771
    767772                if ( is_wp_error( $download ) ) {
     773                        error_log( $_SERVER['REQUEST_URI'] . ' -- download_package() failed ' . var_export( $download, true ) );
    768774                        $this->skin->error( $download );
    769775                        $this->skin->after();
    770776                        if ( ! $options['is_multi'] ) {
    class WP_Upgrader { 
    778784                // Unzips the file into a temporary directory.
    779785                $working_dir = $this->unpack_package( $download, $delete_package );
    780786                if ( is_wp_error( $working_dir ) ) {
     787                        error_log( $_SERVER['REQUEST_URI'] . ' -- unpack_package() failed ' . var_export( $working_dir, true ) );
    781788                        $this->skin->error( $working_dir );
    782789                        $this->skin->after();
    783790                        if ( ! $options['is_multi'] ) {
    class WP_Upgrader { 
    810817
    811818                $this->skin->set_result( $result );
    812819                if ( is_wp_error( $result ) ) {
     820                        error_log( $_SERVER['REQUEST_URI'] . ' -- install_package() failed ' . var_export( $result, true ) );
    813821                        $this->skin->error( $result );
    814822
    815823                        if ( ! method_exists( $this->skin, 'hide_process_failed' ) || ! $this->skin->hide_process_failed( $result ) ) {