Support 'wporg_status' and 'wporg_last_updated' as optional wp plugin list fields#382
Support 'wporg_status' and 'wporg_last_updated' as optional wp plugin list fields#382danielbachhuber merged 21 commits intowp-cli:mainfrom janw-me:main
wp plugin list fields#382Conversation
|
@janw-me the API-specific stuff should be included in the |
danielbachhuber
left a comment
There was a problem hiding this comment.
Great start!
I'd like to standardize on wporg_status and wporg_last_updated as the key names.
src/Plugin_Command.php
Outdated
| protected function get_wporg_data( $plugin_name ) { | ||
| $data = [ | ||
| 'status' => 'no_wp_org', | ||
| 'last_updated' => '-', |
There was a problem hiding this comment.
| 'last_updated' => '-', | |
| 'last_updated' => '', |
We can leave this empty when it's not present.
src/Plugin_Command.php
Outdated
| */ | ||
| protected function get_wporg_data( $plugin_name ) { | ||
| $data = [ | ||
| 'status' => 'no_wp_org', |
There was a problem hiding this comment.
| 'status' => 'no_wp_org', | |
| 'status' => '', |
We can leave this empty when it's not present.
There was a problem hiding this comment.
I was not happy about the label itself.
But personally I prefer when a check like this tells "something". Empty can feel like an unknown failure.
Are there other places where we leave fields empty?
| // Just because the plugin is not in the api, does not mean it was never on .org. | ||
| } | ||
|
|
||
| $request = wp_remote_get( "https://plugins.trac.wordpress.org/log/{$plugin_name}/?limit=1&mode=stop_on_copy&format=rss" ); |
There was a problem hiding this comment.
Should we only make this request if we're checking for the date?
There was a problem hiding this comment.
I made a better check in d7ec274
The answer is, not always,
When the call to api.wp is not succesfull, we need to check the SVN to distinguish between closed and never on .org.
Relabeling done in: fd9a235 |
src/Plugin_Command.php
Outdated
| 'auto_update' => false, | ||
| 'author' => $item_data['Author'], | ||
| 'wporg_status' => 'no_wp_org', | ||
| 'wporg_last_updated' => '-', |
There was a problem hiding this comment.
As per another comment, let's leave this empty per default instead
| 'wporg_last_updated' => '-', | |
| 'wporg_last_updated' => '', |
@janw-me Note: The I'll see how we can adapt it so it does not unnecessarily do the full request. |
|
@janw-me Once your PR is ready, can you also update the PR description with details on how the new feature works? Thanks! |
wp plugin list fields

Fixes idea#36
Extends
wp plugin listwith the fields:wp_orgwhich will get the wp.org status (active, closed or empty)wp_org_updatedwhich will get the last svn commit date if it's a wp.org plugin.These fields will take a look at the status of the plugin on wordpress.org and if it ever was a .org plugin it can display the last commit date.
Related wp-cli/wp-cli#5859