Changeset 48698 for branches/5.5/src/wp-admin/includes/theme.php
- Timestamp:
- 07/30/2020 10:02:54 PM (4 years ago)
- Location:
- branches/5.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.5
-
branches/5.5/src/wp-admin/includes/theme.php
r48659 r48698 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,
Note: See TracChangeset
for help on using the changeset viewer.