Skip to content

Commit b207e08

Browse files
committed
Use afragen/wordpress-plugin-readme-parser package
1 parent 73b482c commit b207e08

File tree

3 files changed

+9
-203
lines changed

3 files changed

+9
-203
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
}
1818
],
1919
"require": {
20+
"afragen/wordpress-plugin-readme-parser": "dev-master",
2021
"composer/semver": "^1.4 || ^2 || ^3",
2122
"wp-cli/wp-cli": "^2.10"
2223
},

src/Plugin_Command.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

3+
use WordPressdotorg\Plugin_Directory\Readme\Parser;
34
use WP_CLI\ParsePluginNameInput;
4-
use WP_CLI\ParsePluginReadme;
55
use WP_CLI\Utils;
66
use WP_CLI\WpOrgApi;
77

@@ -44,7 +44,6 @@
4444
class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
4545

4646
use ParsePluginNameInput;
47-
use ParsePluginReadme;
4847

4948
protected $item_type = 'plugin';
5049
protected $upgrade_refresh = 'wp_update_plugins';
@@ -739,13 +738,18 @@ protected function get_item_list() {
739738
'file' => $file,
740739
'auto_update' => in_array( $file, $auto_updates, true ),
741740
'author' => $details['Author'],
741+
'tested_up_to' => '',
742742
'wporg_status' => $wporg_info['status'],
743743
'wporg_last_updated' => $wporg_info['last_updated'],
744744
];
745745

746746
// Include information from the plugin readme.txt headers.
747-
$plugin_headers = $this->get_plugin_headers( $name );
748-
$items[ $file ]['tested_up_to'] = isset( $plugin_headers['tested_up_to'] ) ? $plugin_headers['tested_up_to'] : '';
747+
$plugin_readme = WP_PLUGIN_DIR . '/' . $name . '/readme.txt';
748+
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 : '';
752+
}
749753

750754
if ( null === $update_info ) {
751755
// Get info for all plugins that don't have an update.

src/WP_CLI/ParsePluginReadme.php

Lines changed: 0 additions & 199 deletions
This file was deleted.

0 commit comments

Comments
 (0)