-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Milestone
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
The command currently only parses the version from PHP files, hence not getting the version of a theme in style.css hence not including it in the archive filename.
Describe how other contributors can replicate this bug
Run the dist-archive command on a theme
Describe what you would expect as the correct outcome
An archive that includes the theme version in the filename.
Let us know what environment you are running this on
> wp cli info
OS: Linux 5.4.0-100-generic #113~18.04.1-Ubuntu SMP Mon Feb 7 15:02:59 UTC 2022 x86_64
Shell:
PHP binary: /usr/local/bin/php
PHP version: 7.4.28
php.ini used: /usr/local/etc/php/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.5.12-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
SQL modes:
WP-CLI root dir: /var/www/html/wp-content/themes/foo/vendor/wp-cli/wp-cli
WP-CLI vendor dir: /var/www/html/wp-content/themes/foo/vendor
WP_CLI phar path:
WP-CLI packages dir: /home/wordpress/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.6.0
Provide a possible solution
This probably should also parse style.css, the regex could stay the same I suppose.
dist-archive-command/src/Dist_Archive_Command.php
Lines 95 to 102 in d6d0144
| $version = ''; | |
| foreach ( glob( $path . '/*.php' ) as $php_file ) { | |
| $contents = file_get_contents( $php_file, false, null, 0, 5000 ); | |
| if ( preg_match( '#\* Version:(.+)#', $contents, $matches ) ) { | |
| $version = '.' . trim( $matches[1] ); | |
| break; | |
| } | |
| } |
Provide additional context/Screenshots