Changeset 48688
- Timestamp:
- 07/29/2020 07:59:30 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/theme.js
r48650 r48688 803 803 // Support concurrent clicks in different Theme Details overlays. 804 804 callback = function( event, data ) { 805 var autoupdate; 805 806 if ( _this.model.get( 'id' ) === data.asset ) { 806 _this.model.set( { autoupdate: 'enable' === data.state } ); 807 autoupdate = _this.model.get( 'autoupdate' ); 808 autoupdate.enabled = 'enable' === data.state; 809 _this.model.set( { autoupdate: autoupdate } ); 807 810 $( document ).off( 'wp-auto-update-setting-changed', callback ); 808 811 } -
trunk/src/wp-admin/includes/theme.php
r48659 r48688 648 648 } 649 649 650 $updates = array(); 650 $updates = array(); 651 $no_updates = array(); 651 652 if ( current_user_can( 'update_themes' ) ) { 652 653 $updates_transient = get_site_transient( 'update_themes' ); 653 654 if ( isset( $updates_transient->response ) ) { 654 655 $updates = $updates_transient->response; 656 } 657 if ( isset( $updates_transient->no_update ) ) { 658 $no_updates = $updates_transient->no_update; 655 659 } 656 660 } … … 690 694 $auto_update = in_array( $slug, $auto_updates, true ); 691 695 $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update'; 696 697 if ( isset( $updates[ $slug ] ) ) { 698 $auto_update_supported = true; 699 $auto_update_filter_payload = (object) $updates[ $slug ]; 700 } elseif ( isset( $no_updates[ $slug ] ) ) { 701 $auto_update_supported = true; 702 $auto_update_filter_payload = (object) $no_updates[ $slug ]; 703 } else { 704 $auto_update_supported = false; 705 /* 706 * Create the expected payload for the auto_update_theme filter, this is the same data 707 * as contained within $updates or $no_updates but used when the Theme is not known. 708 */ 709 $auto_update_filter_payload = (object) array( 710 'theme' => $slug, 711 'new_version' => $theme->get( 'Version' ), 712 'url' => '', 713 'package' => '', 714 'requires' => $theme->get( 'RequiresWP' ), 715 'requires_php' => $theme->get( 'RequiresPHP' ), 716 ); 717 } 718 719 /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ 720 $auto_update_forced = apply_filters( 'auto_update_theme', null, $auto_update_filter_payload ); 692 721 693 722 $prepared_themes[ $slug ] = array( … … 711 740 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 712 741 'update' => get_theme_update_available( $theme ), 713 'autoupdate' => $auto_update, 742 'autoupdate' => array( 743 'enabled' => $auto_update || $auto_update_forced, 744 'supported' => $auto_update_supported, 745 'forced' => $auto_update_forced, 746 ), 714 747 'actions' => array( 715 748 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, -
trunk/src/wp-admin/themes.php
r48659 r48688 676 676 $template = ' 677 677 <div class="theme-autoupdate"> 678 <# if ( data.autoupdate ) { #> 679 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable"> 680 <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span> 681 </button> 682 <# } else { #> 683 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable"> 684 <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span> 685 </button> 678 <# if ( data.autoupdate.supported ) { #> 679 <# if ( data.autoupdate.forced === false ) { #> 680 ' . __( 'Auto-updates disabled' ) . ' 681 <# } else if ( data.autoupdate.forced ) { #> 682 ' . __( 'Auto-updates enabled' ) . ' 683 <# } else if ( data.autoupdate.enabled ) { #> 684 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable"> 685 <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span> 686 </button> 687 <# } else { #> 688 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable"> 689 <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span> 690 </button> 691 <# } #> 686 692 <# } #> 687 693 <# if ( data.hasUpdate ) { #> 688 <# if ( data.autoupdate ) { #>694 <# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #> 689 695 <span class="auto-update-time"> 690 696 <# } else { #> -
trunk/src/wp-includes/update.php
r48344 r48688 622 622 if ( is_array( $response ) ) { 623 623 $new_update->response = $response['themes']; 624 $new_update->no_update = $response['no_update']; 624 625 $new_update->translations = $response['translations']; 625 626 }
Note: See TracChangeset
for help on using the changeset viewer.