Skip to content

Commit fd9a235

Browse files
committed
Renamed wporg keys
1 parent d7ec274 commit fd9a235

File tree

2 files changed

+55
-55
lines changed

2 files changed

+55
-55
lines changed

features/plugin-list-wporg-status.feature

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ Feature: Update WordPress plugins
1515
*/
1616
"""
1717

18-
When I run `wp plugin list --name=wordpress-importer --field=wp_org_updated`
18+
When I run `wp plugin list --name=wordpress-importer --field=wporg_last_updated`
1919
Then STDOUT should not be empty
2020
And save STDOUT as {COMMIT_DATE}
2121

22-
When I run `wp plugin list --fields=name,wp_org`
22+
When I run `wp plugin list --fields=name,wporg_status`
2323
Then STDOUT should be a table containing rows:
24-
| name | wp_org |
25-
| wordpress-importer | active |
26-
| no-longer-in-directory | closed |
27-
| never-wporg | no_wp_org |
24+
| name | wporg_status |
25+
| wordpress-importer | active |
26+
| no-longer-in-directory | closed |
27+
| never-wporg | no_wp_org |
2828

29-
When I run `wp plugin list --fields=name,wp_org_updated`
29+
When I run `wp plugin list --fields=name,wporg_last_updated`
3030
Then STDOUT should be a table containing rows:
31-
| name | wp_org_updated |
32-
| wordpress-importer | {COMMIT_DATE} |
33-
| no-longer-in-directory | 2017-11-13 |
34-
| never-wporg | - |
31+
| name | wporg_last_updated |
32+
| wordpress-importer | {COMMIT_DATE} |
33+
| no-longer-in-directory | 2017-11-13 |
34+
| never-wporg | - |
3535

36-
When I run `wp plugin list --fields=name,wp_org,wp_org_updated`
36+
When I run `wp plugin list --fields=name,wporg_status,wporg_last_updated`
3737
Then STDOUT should be a table containing rows:
38-
| name | wp_org | wp_org_updated |
39-
| wordpress-importer | active | {COMMIT_DATE} |
40-
| no-longer-in-directory | closed | 2017-11-13 |
41-
| never-wporg | no_wp_org | - |
38+
| name | wporg_status | wporg_last_updated |
39+
| wordpress-importer | active | {COMMIT_DATE} |
40+
| no-longer-in-directory | closed | 2017-11-13 |
41+
| never-wporg | no_wp_org | - |

src/Plugin_Command.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
4747
protected $upgrade_refresh = 'wp_update_plugins';
4848
protected $upgrade_transient = 'update_plugins';
4949
protected $check_wporg = [
50-
'status' => false,
51-
'update_date' => false,
50+
'status' => false,
51+
'last_updated' => false,
5252
];
5353

5454
protected $obj_fields = array(
@@ -253,19 +253,19 @@ protected function get_all_items() {
253253
$wporg_info = $this->get_wporg_data( $mu_name );
254254

255255
$items[ $file ] = array(
256-
'name' => $mu_name,
257-
'status' => 'must-use',
258-
'update' => false,
259-
'update_version' => null,
260-
'update_package' => null,
261-
'version' => $mu_version,
262-
'update_id' => '',
263-
'title' => $mu_title,
264-
'description' => $mu_description,
265-
'file' => $file,
266-
'auto_update' => false,
267-
'wp_org' => $wporg_info['status'],
268-
'wp_org_updated' => $wporg_info['last_updated'],
256+
'name' => $mu_name,
257+
'status' => 'must-use',
258+
'update' => false,
259+
'update_version' => null,
260+
'update_package' => null,
261+
'version' => $mu_version,
262+
'update_id' => '',
263+
'title' => $mu_title,
264+
'description' => $mu_description,
265+
'file' => $file,
266+
'auto_update' => false,
267+
'wporg_status' => $wporg_info['status'],
268+
'wporg_last_updated' => $wporg_info['last_updated'],
269269
);
270270
}
271271

@@ -719,20 +719,20 @@ protected function get_item_list() {
719719

720720
$duplicate_names[ $name ][] = $file;
721721
$items[ $file ] = [
722-
'name' => $name,
723-
'status' => $this->get_status( $file ),
724-
'update' => (bool) $update_info,
725-
'update_version' => isset( $update_info ) && isset( $update_info['new_version'] ) ? $update_info['new_version'] : null,
726-
'update_package' => isset( $update_info ) && isset( $update_info['package'] ) ? $update_info['package'] : null,
727-
'version' => $details['Version'],
728-
'update_id' => $file,
729-
'title' => $details['Name'],
730-
'description' => wordwrap( $details['Description'] ),
731-
'file' => $file,
732-
'auto_update' => in_array( $file, $auto_updates, true ),
733-
'author' => $details['Author'],
734-
'wp_org' => $wporg_info['status'],
735-
'wp_org_updated' => $wporg_info['last_updated'],
722+
'name' => $name,
723+
'status' => $this->get_status( $file ),
724+
'update' => (bool) $update_info,
725+
'update_version' => isset( $update_info ) && isset( $update_info['new_version'] ) ? $update_info['new_version'] : null,
726+
'update_package' => isset( $update_info ) && isset( $update_info['package'] ) ? $update_info['package'] : null,
727+
'version' => $details['Version'],
728+
'update_id' => $file,
729+
'title' => $details['Name'],
730+
'description' => wordwrap( $details['Description'] ),
731+
'file' => $file,
732+
'auto_update' => in_array( $file, $auto_updates, true ),
733+
'author' => $details['Author'],
734+
'wporg_status' => $wporg_info['status'],
735+
'wporg_last_updated' => $wporg_info['last_updated'],
736736
];
737737

738738
if ( null === $update_info ) {
@@ -770,7 +770,7 @@ protected function get_wporg_data( $plugin_name ) {
770770
'status' => 'no_wp_org',
771771
'last_updated' => '-',
772772
];
773-
if ( ! $this->check_wporg['status'] && ! $this->check_wporg['update_date'] ) {
773+
if ( ! $this->check_wporg['status'] && ! $this->check_wporg['last_updated'] ) {
774774
return $data;
775775
}
776776

@@ -779,7 +779,7 @@ protected function get_wporg_data( $plugin_name ) {
779779
$response_code = wp_remote_retrieve_response_code( $request );
780780
if ( 200 === $response_code ) {
781781
$data['status'] = 'active';
782-
if ( ! $this->check_wporg['update_date'] ) {
782+
if ( ! $this->check_wporg['last_updated'] ) {
783783
return $data; // The plugin is active on .org, but we don't need the date.
784784
}
785785
}
@@ -1252,8 +1252,8 @@ public function delete( $args, $assoc_args = array() ) {
12521252
* * file
12531253
* * auto_update
12541254
* * author
1255-
* * wp_org
1256-
* * wp_org_updated
1255+
* * wporg_status
1256+
* * wporg_last_updated
12571257
*
12581258
* ## EXAMPLES
12591259
*
@@ -1281,16 +1281,16 @@ public function delete( $args, $assoc_args = array() ) {
12811281
public function list_( $_, $assoc_args ) {
12821282
$fields = Utils\get_flag_value( $assoc_args, 'fields' );
12831283
if ( ! empty( $fields ) ) {
1284-
$fields = explode( ',', $fields );
1285-
$this->check_wporg['status'] = in_array( 'wp_org', $fields, true );
1286-
$this->check_wporg['update_date'] = in_array( 'wp_org_updated', $fields, true );
1284+
$fields = explode( ',', $fields );
1285+
$this->check_wporg['status'] = in_array( 'wporg_status', $fields, true );
1286+
$this->check_wporg['last_updated'] = in_array( 'wporg_last_updated', $fields, true );
12871287
}
12881288

12891289
$field = Utils\get_flag_value( $assoc_args, 'field' );
1290-
if ( 'wp_org' === $field ) {
1290+
if ( 'wporg_status' === $field ) {
12911291
$this->check_wporg['status'] = true;
1292-
} elseif ( 'wp_org_updated' === $field ) {
1293-
$this->check_wporg['update_date'] = true;
1292+
} elseif ( 'wporg_last_updated' === $field ) {
1293+
$this->check_wporg['last_updated'] = true;
12941294
}
12951295

12961296
parent::_list( $_, $assoc_args );

0 commit comments

Comments
 (0)