-
Notifications
You must be signed in to change notification settings - Fork 85
Support WordPress.org plugin/theme directory URLs in install commands #483
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: swissspidy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
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.
Pull request overview
This pull request adds support for installing WordPress plugins and themes directly from WordPress.org directory URLs (e.g., https://wordpress.org/plugins/akismet/). Previously, users attempting this would encounter PCLZIP errors because the code treated these URLs as direct ZIP downloads.
Changes:
- Added URL pattern detection in
CommandWithUpgrade::install()to identify and extract slugs from WordPress.org directory URLs - Updated command documentation in
Plugin_CommandandTheme_Commandto reflect the new capability - Added comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/WP_CLI/CommandWithUpgrade.php | Added regex pattern matching to detect WordPress.org directory URLs and route them through the repository installation flow instead of treating them as ZIP downloads |
| src/Plugin_Command.php | Updated parameter documentation and added usage examples demonstrating installation from WordPress.org plugin directory URLs |
| src/Theme_Command.php | Updated parameter documentation and added usage examples demonstrating installation from WordPress.org theme directory URLs |
| features/plugin-install.feature | Added test scenarios for installing plugins via directory URLs with and without activation flags |
| features/theme-install.feature | Added test scenarios for installing themes via directory URLs with and without activation flags |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Users attempting to install plugins via WordPress.org directory URLs (e.g.,
https://wordpress.org/plugins/akismet/) encounter PCLZIP errors because the code treats these URLs as direct ZIP downloads, which they are not.Changes
URL Detection in
CommandWithUpgrade::install()~^https?://wordpress\.org/(plugins|themes)/([^/]+)/?~Detected WordPress.org plugins directory URL, using slug: akismetUpdated Command Documentation
Plugin_CommandandTheme_Commandto indicate directory URL supportTest Coverage
Example Usage
The implementation preserves existing behavior for direct ZIP URLs, GitHub URLs, and plain slugs.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.wordpress.org/usr/bin/curl curl -s REDACTED grep -l hUpgrade mmand/vendor/behat/behat/src/Behat/Config/Suite.php ep hUpgrade tainerLoader.phprev-list mposer/vendor/biremotes/origin/main..copilot/fix-plugin-install-zip-error grep -l '-d short_open_tag=Off' '-d error_reporting=E_ALL' '-n' '-l' './src/Plugin_Command.php' mmand/src/Theme_Command.php /home/REDACTED/.config/composer/vendor/bin/grep hUpgrade t/LifecycleEvent/home/REDACTED/work/extension-command/extension-command/vendor/bin/run-phpstan-tes--no-abbrev grep grep(dns block)/usr/bin/curl curl -s REDACTED -main/dist/ripgrep/bin/linux-x64origin -l hUpgrade mmand/src/WP_CLI/CommandWithUpgrade.php /usr/bin/grep hUpgrade er/EventDispatch-c tnet/tools/grep grep -l hUpgrade and/extension-command/vendor/behat/behat/src/Behat/Config/Suite.php ndor/bin/grep hUpgrade er.php ep grep(dns block)downloads.wordpress.org/usr/bin/curl curl -sSfL REDACTED grep -l hUpgrade and/extension-command/vendor/beh-l rgo/bin/grep hUpgrade ter.php n/grep grep /wp hUpgrade and/extension-command/src/WP_CLI/ParseThemeNameInput.php mposer/vendor/bin/grep hUpgrade Printer.php rep grep(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>Unable to install plugin by plugin directory URL</issue_title>
<issue_description>## Bug Report
Describe the current, buggy behavior
plugin install fails with ZIP error. php 8.3 and php 8.4
A clear and concise description of the behavior that produces a wrong result or error.
PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
Remember to provide some context to make sure we're all on the same page when reasoning about this.
Describe how other contributors can replicate this bug
Describe what you would expect as the correct outcome
a plugin to be installed and activated. It used to work.
Let us know what environment you are running this on
Provide a possible solution
maybe the issue is with wp org not providing a zip file OR wp-cli can't download the file or it gets broken during transfer ?
full debug