Changeset 48417
- Timestamp:
- 07/10/2020 06:06:46 AM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/common.js
r48267 r48417 1607 1607 }); 1608 1608 1609 // On the "Update plugin/theme from uploaded zip" screen 1610 // hide the "Replace current with uploaded" button and show a warning in 1 hour and 59 minutes. 1611 $document.ready( function( $ ) { 1612 var $overwrite, $warning; 1613 1614 if ( ! $body.hasClass( 'update-php' ) ) { 1615 return; 1616 } 1617 1618 $overwrite = $( 'a.update-from-upload-overwrite' ); 1619 $warning = $( '.update-from-upload-expired' ); 1620 1621 if ( ! $overwrite.length || ! $warning.length ) { 1622 return; 1623 } 1624 1625 window.setTimeout( 1626 function() { 1627 $overwrite.hide(); 1628 $warning.removeClass( 'hidden' ); 1629 1630 if ( window.wp && window.wp.a11y ) { 1631 window.wp.a11y.speak( $warning.text() ); 1632 } 1633 }, 1634 7140000 // 119 minutes. The uploaded file is deleted after 2 hours. 1635 ); 1636 } ); 1637 1609 1638 // Fire a custom jQuery event at the end of window resize. 1610 1639 ( function() { -
trunk/src/wp-admin/includes/class-plugin-installer-skin.php
r48390 r48417 293 293 294 294 $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>', 296 296 wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'plugin-upload' ), 297 esc_html( __( 'Replace current with uploaded' ))297 __( 'Replace current with uploaded' ) 298 298 ); 299 299 } else { … … 301 301 } 302 302 303 $cancel_url = add_query_arg( 'action', 'upload-plugin-cancel-overwrite', $this->url ); 304 303 305 $install_actions['plugins_page'] = sprintf( 304 306 '<a class="button" href="%s">%s</a>', 305 self_admin_url( 'plugin-install.php' ),307 wp_nonce_url( $cancel_url, 'plugin-upload-cancel-overwrite' ), 306 308 __( 'Cancel and go back' ) 307 309 ); … … 319 321 320 322 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 ); 321 327 echo '<p class="update-from-upload-actions">' . implode( ' ', (array) $install_actions ) . '</p>'; 322 328 } -
trunk/src/wp-admin/includes/class-theme-installer-skin.php
r48390 r48417 322 322 323 323 $install_actions['ovewrite_theme'] = sprintf( 324 '<a class="button button-primary " href="%s" target="_parent">%s</a>',324 '<a class="button button-primary update-from-upload-overwrite" href="%s" target="_parent">%s</a>', 325 325 wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'theme-upload' ), 326 esc_html( __( 'Replace current with uploaded' ))326 __( 'Replace current with uploaded' ) 327 327 ); 328 328 } else { … … 330 330 } 331 331 332 $cancel_url = add_query_arg( 'action', 'upload-theme-cancel-overwrite', $this->url ); 333 332 334 $install_actions['themes_page'] = sprintf( 333 335 '<a class="button" href="%s" target="_parent">%s</a>', 334 self_admin_url( 'theme-install.php' ),336 wp_nonce_url( $cancel_url, 'theme-upload-cancel-overwrite' ), 335 337 __( 'Cancel and go back' ) 336 338 ); … … 348 350 349 351 if ( ! empty( $install_actions ) ) { 352 printf( 353 '<p class="update-from-upload-expired hidden">%s</p>', 354 __( 'The uploaded file has expired. Please go back and upload it again.' ) 355 ); 350 356 echo '<p class="update-from-upload-actions">' . implode( ' ', (array) $install_actions ) . '</p>'; 351 357 } -
trunk/src/wp-admin/includes/class-wp-media-list-table.php
r48352 r48417 69 69 public function prepare_items() { 70 70 global $wp_query, $post_mime_types, $avail_post_mime_types, $mode; 71 72 // Exclude attachments scheduled for deletion in the next two hours 73 // if they are for zip packages for interrupted or failed updates. 74 // See File_Upload_Upgrader class. 75 $not_in = array(); 76 77 foreach ( _get_cron_array() as $cron ) { 78 if ( isset( $cron['upgrader_scheduled_cleanup'] ) ) { 79 $details = reset( $cron['upgrader_scheduled_cleanup'] ); 80 81 if ( ! empty( $details['args'][0] ) ) { 82 $not_in[] = (int) $details['args'][0]; 83 } 84 } 85 } 86 87 if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) { 88 $not_in = array_merge( array_values( $_REQUEST['post__not_in'] ), $not_in ); 89 } 90 91 if ( ! empty( $not_in ) ) { 92 $_REQUEST['post__not_in'] = $not_in; 93 } 71 94 72 95 list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); -
trunk/src/wp-admin/update.php
r48390 r48417 17 17 18 18 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 19 20 wp_enqueue_script( 'wp-a11y' ); 19 21 20 22 if ( isset( $_GET['action'] ) ) { … … 175 177 require_once ABSPATH . 'wp-admin/admin-footer.php'; 176 178 179 } elseif ( 'upload-plugin-cancel-overwrite' === $action ) { 180 if ( ! current_user_can( 'upload_plugins' ) ) { 181 wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); 182 } 183 184 check_admin_referer( 'plugin-upload-cancel-overwrite' ); 185 186 // Make sure the attachment still exists, or File_Upload_Upgrader will call wp_die() 187 // that shows a generic "Please select a file" error. 188 if ( ! empty( $_GET['package'] ) ) { 189 $attachment_id = (int) $_GET['package']; 190 191 if ( get_post( $attachment_id ) ) { 192 $file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' ); 193 $file_upload->cleanup(); 194 } 195 } 196 197 wp_redirect( self_admin_url( 'plugin-install.php' ) ); 198 exit; 177 199 } elseif ( 'upgrade-theme' === $action ) { 178 200 … … 298 320 require_once ABSPATH . 'wp-admin/admin-footer.php'; 299 321 322 } elseif ( 'upload-theme-cancel-overwrite' === $action ) { 323 if ( ! current_user_can( 'upload_themes' ) ) { 324 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); 325 } 326 327 check_admin_referer( 'theme-upload-cancel-overwrite' ); 328 329 // Make sure the attachment still exists, or File_Upload_Upgrader will call wp_die() 330 // that shows a generic "Please select a file" error. 331 if ( ! empty( $_GET['package'] ) ) { 332 $attachment_id = (int) $_GET['package']; 333 334 if ( get_post( $attachment_id ) ) { 335 $file_upload = new File_Upload_Upgrader( 'themezip', 'package' ); 336 $file_upload->cleanup(); 337 } 338 } 339 340 wp_redirect( self_admin_url( 'theme-install.php' ) ); 341 exit; 300 342 } else { 301 343 /**
Note: See TracChangeset
for help on using the changeset viewer.