Ticket #51129: 51129.diff
File 51129.diff, 3.4 KB (added by , 3 years ago) |
---|
-
wp-admin/includes/class-wp-ms-themes-list-table.php
diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php index f67c7bd693..3531302014 100644
a b class WP_MS_Themes_List_Table extends WP_List_Table { 136 136 137 137 $current = get_site_transient( 'update_themes' ); 138 138 $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current; 139 $theme_data = array_merge( $current->response, $current->no_update ); 139 140 140 141 foreach ( (array) $themes['all'] as $key => $theme ) { 141 142 if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) { … … class WP_MS_Themes_List_Table extends WP_List_Table { 151 152 $filter = $theme->is_allowed( $allowed_where, $this->site_id ) ? 'enabled' : 'disabled'; 152 153 $themes[ $filter ][ $key ] = $themes['all'][ $key ]; 153 154 155 // Extra info if known. array_merge() ensures $theme_data has precedence if keys collide. 156 if ( isset( $current->response[ $key ] ) ) { 157 $current->response[$key] = array_merge( (array) $current->response[ $key ], array( 'update-supported' => true ) ); 158 } elseif ( isset( $current->no_update[ $key ] ) ) { 159 $current->no_update[$key] = array_merge( (array) $current->no_update[ $key ], array( 'update-supported' => true ) ); 160 } 161 162 /* 163 * Create the expected payload for the auto_update_theme filter, this is the same data 164 * as contained within $updates or $no_updates but used when the Theme is not known. 165 */ 166 $filter_payload = array( 167 'theme' => $key, 168 'new_version' => $theme->get( 'Version' ), 169 'url' => '', 170 'package' => '', 171 'requires' => $theme->get( 'RequiresWP' ), 172 'requires_php' => $theme->get( 'RequiresPHP' ), 173 'update-supported' => false, 174 ); 175 176 $filter_payload = array_merge( $filter_payload, array_intersect_key( $theme_data, $filter_payload ) ); 177 178 $type = 'theme'; 179 /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ 180 $auto_update_forced = apply_filters( "auto_update_{$type}", null, $filter_payload ); 181 182 if ( ! is_null( $auto_update_forced ) ) { 183 $themes['auto-update-forced'][$key] = $auto_update_forced; 184 } 185 154 186 if ( $this->show_autoupdates ) { 155 187 if ( in_array( $key, $auto_updates, true ) ) { 156 188 $themes['auto-update-enabled'][ $key ] = $themes['all'][ $key ]; 157 } else {189 } elseif( array_key_exists( $key, $current->response ) || array_key_exists( $key, $current->no_update ) ) { 158 190 $themes['auto-update-disabled'][ $key ] = $themes['all'][ $key ]; 159 191 } 160 192 } 161 193 } 162 194 195 set_site_transient( 'update_themes', $current ); 196 163 197 if ( $s ) { 164 198 $status = 'search'; 165 199 $themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), array( $this, '_search_callback' ) ); … … class WP_MS_Themes_List_Table extends WP_List_Table { 732 766 $text = __( 'Disable auto-updates' ); 733 767 $action = 'disable'; 734 768 $time_class = ''; 735 } else {769 } elseif ( array_key_exists( $stylesheet, $available_updates->response ) || array_key_exists( $stylesheet, $available_updates->no_update ) ) { 736 770 $text = __( 'Enable auto-updates' ); 737 771 $action = 'enable'; 738 772 $time_class = ' hidden'; 773 } else { 774 $text = ''; 775 $action = 'unable'; 776 $time_class = ' hidden'; 739 777 } 740 778 741 779 $query_args = array(