-
Notifications
You must be signed in to change notification settings - Fork 85
Support installing plugins from single PHP file URLs #486
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 <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…oad message timing Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…plugin headers Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…dation Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
|
@copilot Make sure |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
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 PR enables wp plugin install to accept URLs pointing to single PHP files in addition to ZIP archives, with special support for GitHub Gist URLs.
Changes:
- Added detection and installation logic for single PHP file URLs
- Implemented GitHub Gist page URL resolution to raw file URLs via the GitHub API
- Added comprehensive test coverage for PHP file installations,
--forceflag behavior, and Gist URL handling
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/WP_CLI/CommandWithUpgrade.php | Core implementation with Gist URL detection, raw URL conversion via GitHub API, and PHP file installation with security validations |
| src/Plugin_Command.php | Updated documentation to reflect support for PHP file URLs |
| features/plugin-install.feature | Added test scenarios for PHP file installations, --force flag, and Gist page URLs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/gemini review |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add specific error handling for HTTP codes 401, 500, 503 - Add fallback for malformed rate limit responses - Verify plugin directory creation after wp_mkdir_p() - Fix regex pattern to properly match uppercase hex in gist IDs - Add catch-all for unexpected HTTP status codes Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Anonymous gists don't have a username in the URL path (e.g., gist.github.com/1234567890abcdef). Updated regex to make the username segment optional using non-capturing group (?:[^/]+/)? so both user-owned and anonymous gists are supported. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Convert extension to lowercase before comparison in all PHP extension checks to handle files with uppercase extensions (e.g., .PHP, .Php). This makes the validation more robust and consistent across: - Sanitized filename validation - URL path detection - Gist file filtering Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
| } | ||
|
|
||
| // Find PHP files in the gist | ||
| $php_files = []; |
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.
Do we use short array syntax in WP-CLI?
Implementation Plan for Single PHP Plugin File Installation
CommandWithUpgrade.phpOriginal prompt
plugin install#233💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.