Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
55a4daa
Initial plan
Copilot Jan 19, 2026
da838b3
Add support for installing plugins from single PHP file URLs
Copilot Jan 19, 2026
1f1924d
Add documentation and additional tests for PHP file installation
Copilot Jan 19, 2026
075cb79
Address code review feedback: add validation and improve code structure
Copilot Jan 19, 2026
0b4d7aa
Add security validations for path traversal and improve UX with downl…
Copilot Jan 19, 2026
78e54f7
Fix security validations: properly check path traversal and validate …
Copilot Jan 19, 2026
82f7819
Optimize: check file existence before download and simplify path vali…
Copilot Jan 19, 2026
551fe3e
Add support for GitHub Gist page URLs (gist.github.com)
Copilot Jan 19, 2026
3a4d190
Update src/WP_CLI/CommandWithUpgrade.php
swissspidy Jan 19, 2026
584d505
Update src/WP_CLI/CommandWithUpgrade.php
swissspidy Jan 19, 2026
9f699f1
Update src/WP_CLI/CommandWithUpgrade.php
swissspidy Jan 19, 2026
232e96b
Update src/WP_CLI/CommandWithUpgrade.php
swissspidy Jan 22, 2026
881032e
Improve error handling and validation in gist URL processing
Copilot Jan 22, 2026
264d2aa
Update src/WP_CLI/CommandWithUpgrade.php
swissspidy Jan 22, 2026
7138fb8
Merge branch 'main' into copilot/allow-php-file-install
swissspidy Jan 22, 2026
cb58c28
remove double check
swissspidy Jan 22, 2026
ff342c9
Apply suggestion from @swissspidy
swissspidy Jan 22, 2026
aa00d38
Support anonymous gists by making username optional in regex
Copilot Jan 22, 2026
aadf613
Make PHP extension checks case-insensitive
Copilot Jan 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions features/plugin-install.feature
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,99 @@ Feature: Install WordPress plugins
Error: No plugins installed.
"""

Scenario: Install plugin from a single PHP file URL
Given a WP install

When I run `wp plugin install https://gist.githubusercontent.com/westonruter/dec7d190060732e29a09751ab99cc549/raw/d55866c2fc82ab16f8909ce73fc89986ab28d727/pwa-manifest-short-name.php --activate`
Then STDOUT should contain:
"""
Installing
"""
And STDOUT should contain:
"""
Downloading plugin file from
"""
And STDOUT should contain:
"""
Plugin installed successfully.
"""
And STDOUT should contain:
"""
Activating
"""
And the wp-content/plugins/pwa-manifest-short-name.php file should exist

When I run `wp plugin list --field=name`
Then STDOUT should contain:
"""
pwa-manifest-short-name
"""

When I run `wp plugin list --name=pwa-manifest-short-name --field=status`
Then STDOUT should be:
"""
active
"""

Scenario: Install plugin from a single PHP file URL with --force flag
Given a WP install

When I run `wp plugin install https://gist.githubusercontent.com/westonruter/dec7d190060732e29a09751ab99cc549/raw/d55866c2fc82ab16f8909ce73fc89986ab28d727/pwa-manifest-short-name.php`
Then STDOUT should contain:
"""
Plugin installed successfully.
"""
And the wp-content/plugins/pwa-manifest-short-name.php file should exist

When I try `wp plugin install https://gist.githubusercontent.com/westonruter/dec7d190060732e29a09751ab99cc549/raw/d55866c2fc82ab16f8909ce73fc89986ab28d727/pwa-manifest-short-name.php`
Then STDERR should contain:
"""
Warning: Plugin already installed.
"""
And STDOUT should contain:
"""
Success: Plugin already installed.
"""

When I run `wp plugin install https://gist.githubusercontent.com/westonruter/dec7d190060732e29a09751ab99cc549/raw/d55866c2fc82ab16f8909ce73fc89986ab28d727/pwa-manifest-short-name.php --force`
Then STDOUT should contain:
"""
Plugin installed successfully.
"""
And the wp-content/plugins/pwa-manifest-short-name.php file should exist

Scenario: Install plugin from a GitHub Gist page URL
Given a WP install

When I run `wp plugin install https://gist.github.com/westonruter/dec7d190060732e29a09751ab99cc549 --activate`
Then STDOUT should contain:
"""
Gist resolved to raw file URL.
"""
And STDOUT should contain:
"""
Installing
"""
And STDOUT should contain:
"""
Downloading plugin file from
"""
And STDOUT should contain:
"""
Plugin installed successfully.
"""
And STDOUT should contain:
"""
Activating
"""
And the wp-content/plugins/pwa-manifest-short-name.php file should exist

When I run `wp plugin list --name=pwa-manifest-short-name --field=status`
Then STDOUT should be:
"""
active
"""

Scenario: Install plugin using WordPress.org directory URL
Given a WP install

Expand Down
7 changes: 6 additions & 1 deletion src/Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ protected function filter_item_list( $items, $args ) {
* ## OPTIONS
*
* <plugin|zip|url>...
* : One or more plugins to install. Accepts a plugin slug, the path to a local zip file, a URL to a remote zip file, or a URL to a WordPress.org plugin directory.
* : One or more plugins to install. Accepts a plugin slug, the path to a local zip file, a URL to a remote zip file or PHP file, or a URL to a WordPress.org plugin directory.
*
* [--version=<version>]
* : If set, get that particular version from wordpress.org, instead of the
Expand Down Expand Up @@ -1087,6 +1087,11 @@ protected function filter_item_list( $items, $args ) {
* Plugin updated successfully
* Success: Installed 1 of 1 plugins.
*
* # Install from a remote PHP file
* $ wp plugin install https://example.com/my-plugin.php
* Installing My Plugin (1.0.0)
* Downloading plugin file from https://example.com/my-plugin.php...
*
* # Install a plugin with all its dependencies
* $ wp plugin install my-plugin --with-dependencies
* Installing Required Plugin 1 (1.2.3)
Expand Down
Loading