-
Notifications
You must be signed in to change notification settings - Fork 87
Support 'wporg_status' and 'wporg_last_updated' as optional wp plugin list fields
#382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0c695a5
342aaa1
51b645b
8d05f43
28f9a97
bcbb215
37472a1
665a5eb
1cec36e
d12a9a6
d7ec274
fd9a235
71a1d23
a171f4c
a6e5b0b
096ab96
f5895b8
09d1311
c927a46
9d97c95
1dc730e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,13 +46,13 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { | |||||
| protected $item_type = 'plugin'; | ||||||
| protected $upgrade_refresh = 'wp_update_plugins'; | ||||||
| protected $upgrade_transient = 'update_plugins'; | ||||||
| protected $check_wporg = [ 'status' => false, 'update_date' => false ]; | ||||||
|
|
||||||
| protected $obj_fields = array( | ||||||
| 'name', | ||||||
| 'status', | ||||||
| 'update', | ||||||
| 'version', | ||||||
| 'wordpress.org', | ||||||
| ); | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -702,6 +702,7 @@ protected function get_item_list() { | |||||
| $all_update_info = $this->get_update_info(); | ||||||
| $update_info = ( isset( $all_update_info->response[ $file ] ) && null !== $all_update_info->response[ $file ] ) ? (array) $all_update_info->response[ $file ] : null; | ||||||
| $name = Utils\get_plugin_name( $file ); | ||||||
| $wporg_info = $this->get_wporg_data( $name ); | ||||||
|
|
||||||
| if ( ! isset( $duplicate_names[ $name ] ) ) { | ||||||
| $duplicate_names[ $name ] = array(); | ||||||
|
|
@@ -721,11 +722,11 @@ protected function get_item_list() { | |||||
| 'file' => $file, | ||||||
| 'auto_update' => in_array( $file, $auto_updates, true ), | ||||||
| 'author' => $details['Author'], | ||||||
| 'wordpress.org' => $this->get_dotorg_status( $name ), | ||||||
| 'wp_org' => $wporg_info['status'], | ||||||
| 'wp_org_updated' => $wporg_info['last_updated'], | ||||||
janw-me marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| ]; | ||||||
|
|
||||||
| if ( null === $update_info ) { | ||||||
|
|
||||||
| // Get info for all plugins that don't have an update. | ||||||
| $plugin_update_info = isset( $all_update_info->no_update[ $file ] ) ? $all_update_info->no_update[ $file ] : null; | ||||||
|
|
||||||
|
|
@@ -755,36 +756,49 @@ protected function get_item_list() { | |||||
| * | ||||||
| * @return string The status of the plugin, includes the last update date. | ||||||
| */ | ||||||
| protected function get_dotorg_status( $plugin_name ) { | ||||||
| protected function get_wporg_data( $plugin_name ) { | ||||||
| $data = [ | ||||||
| 'status' => 'no_wp_org', | ||||||
|
||||||
| 'status' => 'no_wp_org', | |
| 'status' => '', |
We can leave this empty when it's not present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'last_updated' => '-', | |
| 'last_updated' => '', |
We can leave this empty when it's not present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we only make this request if we're checking for the date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.

Uh oh!
There was an error while loading. Please reload this page.