Make WordPress Core


Ignore:
Timestamp:
07/10/2020 06:06:46 AM (4 years ago)
Author:
whyisjake
Message:

Upgrade/Install: Ensure cleanup after canceled update.

Ensure that the uploaded zip is hidden from the media library, where a task will remove failed installs after two hours.

Fixes #50612.

Props psykro, desrosj, joyously, azaozz, noisysocks, whyisjake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-plugin-installer-skin.php

    r48390 r48417  
    293293
    294294            $install_actions['ovewrite_plugin'] = sprintf(
    295                 '<a class="button button-primary" href="%s" target="_parent">%s</a>',
     295                '<a class="button button-primary update-from-upload-overwrite" href="%s" target="_parent">%s</a>',
    296296                wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'plugin-upload' ),
    297                 esc_html( __( 'Replace current with uploaded' ) )
     297                __( 'Replace current with uploaded' )
    298298            );
    299299        } else {
     
    301301        }
    302302
     303        $cancel_url = add_query_arg( 'action', 'upload-plugin-cancel-overwrite', $this->url );
     304
    303305        $install_actions['plugins_page'] = sprintf(
    304306            '<a class="button" href="%s">%s</a>',
    305             self_admin_url( 'plugin-install.php' ),
     307            wp_nonce_url( $cancel_url, 'plugin-upload-cancel-overwrite' ),
    306308            __( 'Cancel and go back' )
    307309        );
     
    319321
    320322        if ( ! empty( $install_actions ) ) {
     323            printf(
     324                '<p class="update-from-upload-expired hidden">%s</p>',
     325                __( 'The uploaded file has expired. Please go back and upload it again.' )
     326            );
    321327            echo '<p class="update-from-upload-actions">' . implode( ' ', (array) $install_actions ) . '</p>';
    322328        }
Note: See TracChangeset for help on using the changeset viewer.