@@ -52,6 +52,9 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
5252 'status ' => false ,
5353 'last_updated ' => false ,
5454 ];
55+ protected $ check_headers = [
56+ 'tested_up_to ' => false ,
57+ ];
5558
5659 protected $ obj_fields = array (
5760 'name ' ,
@@ -743,12 +746,14 @@ protected function get_item_list() {
743746 'wporg_last_updated ' => $ wporg_info ['last_updated ' ],
744747 ];
745748
746- // Include information from the plugin readme.txt headers.
747- $ plugin_readme = WP_PLUGIN_DIR . '/ ' . $ name . '/readme.txt ' ;
749+ if ( $ this ->check_headers ['tested_up_to ' ] ) {
750+ // Include information from the plugin readme.txt headers.
751+ $ plugin_readme = WP_PLUGIN_DIR . '/ ' . $ name . '/readme.txt ' ;
748752
749- if ( file_exists ( $ plugin_readme ) ) {
750- $ readme_parser = new Parser ( $ plugin_readme );
751- $ items [ $ file ]['tested_up_to ' ] = $ readme_parser ->tested ? $ readme_parser ->tested : '' ;
753+ if ( file_exists ( $ plugin_readme ) ) {
754+ $ readme_parser = new Parser ( $ plugin_readme );
755+ $ items [ $ file ]['tested_up_to ' ] = $ readme_parser ->tested ? $ readme_parser ->tested : '' ;
756+ }
752757 }
753758
754759 if ( null === $ update_info ) {
@@ -1263,7 +1268,6 @@ public function delete( $args, $assoc_args = array() ) {
12631268 * * version
12641269 * * update_version
12651270 * * auto_update
1266- * * tested_up_to
12671271 *
12681272 * These fields are optionally available:
12691273 *
@@ -1273,6 +1277,7 @@ public function delete( $args, $assoc_args = array() ) {
12731277 * * description
12741278 * * file
12751279 * * author
1280+ * * tested_up_to
12761281 * * wporg_status
12771282 * * wporg_last_updated
12781283 *
@@ -1316,6 +1321,8 @@ public function list_( $_, $assoc_args ) {
13161321 $ fields = explode ( ', ' , $ fields );
13171322 $ this ->check_wporg ['status ' ] = in_array ( 'wporg_status ' , $ fields , true );
13181323 $ this ->check_wporg ['last_updated ' ] = in_array ( 'wporg_last_updated ' , $ fields , true );
1324+
1325+ $ this ->check_headers ['tested_up_to ' ] = in_array ( 'tested_up_to ' , $ fields , true );
13191326 }
13201327
13211328 $ field = Utils \get_flag_value ( $ assoc_args , 'field ' );
@@ -1325,6 +1332,8 @@ public function list_( $_, $assoc_args ) {
13251332 $ this ->check_wporg ['last_updated ' ] = true ;
13261333 }
13271334
1335+ $ this ->check_headers ['tested_up_to ' ] = 'tested_up_to ' === $ field || $ this ->check_headers ['tested_up_to ' ];
1336+
13281337 parent ::_list ( $ _ , $ assoc_args );
13291338 }
13301339
0 commit comments