@@ -348,12 +348,14 @@ protected function update_many( $args, $assoc_args ) {
348348 $ minor = (bool ) Utils \get_flag_value ( $ assoc_args , 'minor ' , false );
349349 $ patch = (bool ) Utils \get_flag_value ( $ assoc_args , 'patch ' , false );
350350
351- if ( 'plugin ' === $ this ->item_type
352- && ( $ minor || $ patch ) ) {
351+ if (
352+ in_array ( $ this ->item_type , [ 'plugin ' , 'theme ' ], true ) &&
353+ ( $ minor || $ patch )
354+ ) {
353355 $ type = $ minor ? 'minor ' : 'patch ' ;
354356 $ insecure = (bool ) Utils \get_flag_value ( $ assoc_args , 'insecure ' , false );
355357
356- $ items_to_update = self ::get_minor_or_patch_updates ( $ items_to_update , $ type , $ insecure , true );
358+ $ items_to_update = self ::get_minor_or_patch_updates ( $ items_to_update , $ type , $ insecure , true , $ this -> item_type );
357359 }
358360
359361 $ exclude = Utils \get_flag_value ( $ assoc_args , 'exclude ' );
@@ -611,19 +613,27 @@ private function get_color( $status ) {
611613 }
612614
613615 /**
614- * Get the minor or patch version for plugins with available updates
616+ * Get the minor or patch version for plugins and themes with available updates
615617 *
616- * @param array $items Plugins with updates.
618+ * @param array $items Items with updates.
617619 * @param string $type Either 'minor' or 'patch'.
618620 * @param bool $insecure Whether to retry without certificate validation on TLS handshake failure.
619621 * @param bool $require_stable Whether to require stable version when comparing versions.
622+ * @param string $item_type Item type, either 'plugin' or 'theme'.
620623 * @return array
621624 */
622- private function get_minor_or_patch_updates ( $ items , $ type , $ insecure , $ require_stable ) {
625+ private function get_minor_or_patch_updates ( $ items , $ type , $ insecure , $ require_stable, $ item_type ) {
623626 $ wp_org_api = new WpOrgApi ( [ 'insecure ' => $ insecure ] );
624627 foreach ( $ items as $ i => $ item ) {
625628 try {
626- $ data = $ wp_org_api ->get_plugin_info ( $ item ['name ' ] );
629+ $ data = call_user_func (
630+ [ $ wp_org_api , "get_ {$ item_type }_info " ],
631+ $ item ['name ' ],
632+ // The default.
633+ 'en_US ' ,
634+ // We are only interested in the versions field.
635+ [ 'versions ' => true ]
636+ );
627637 } catch ( Exception $ exception ) {
628638 unset( $ items [ $ i ] );
629639 continue ;
0 commit comments