get_upgrade_messages example

if ( is_wp_error( $api ) ) {
        $status['errorMessage'] = $api->get_error_message();
        wp_send_json_error( $status );
    }

    $skin     = new WP_Ajax_Upgrader_Skin();
    $upgrader = new Theme_Upgrader( $skin );
    $result   = $upgrader->install( $api->download_link );

    if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
        $status['debug'] = $skin->get_upgrade_messages();
    }

    if ( is_wp_error( $result ) ) {
        $status['errorCode']    = $result->get_error_code();
        $status['errorMessage'] = $result->get_error_message();
        wp_send_json_error( $status );
    } elseif ( is_wp_error( $skin->result ) ) {
        $status['errorCode']    = $skin->result->get_error_code();
        $status['errorMessage'] = $skin->result->get_error_message();
        wp_send_json_error( $status );
    } elseif ( $skin->get_errors()->has_errors() ) {
        
$upgrade_result->add( 'installation_failed', __( 'Installation failed.' ) );
                $skin->error( $upgrade_result );
            } else {
                $skin->feedback( __( 'WordPress updated successfully.' ) );
            }
        }

        $this->update_results[ $type ][] = (object) array(
            'item'     => $item,
            'result'   => $upgrade_result,
            'name'     => $item_name,
            'messages' => $skin->get_upgrade_messages(),
        );

        return $upgrade_result;
    }

    /** * Kicks off the background update process, looping through all pending updates. * * @since 3.7.0 */
    public function run() {
        
Home | Imprint | This part of the site doesn't use cookies.