You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe your use case and the problem you are facing
I would like to be able to list the download URLs for plugin updates. For premium plugins, where the licence key can only be used on one site, I need to get the authenticated download URL so I can download with cURL and test the plugin locally.
Currently this table can be generated:
$ wp plugin list --update=available --fields=name,status,update,version,update_version
+------------------+--------+-----------+---------+----------------+
| name | status | update | version | update_version |
+------------------+--------+-----------+---------+----------------+
| a-premium-plugin | active | available | 1.2.3 | 2.3.4 |
+------------------+--------+-----------+---------+----------------+
Describe the solution you'd like
$ wp plugin list --update=available --fields=name,status,update,version,update_version,update_url
+------------------+--------+-----------+---------+----------------+---------------------------------------------------------------+
| name | status | update | version | update_version | update_url |
+------------------+--------+-----------+---------+----------------+---------------------------------------------------------------+
| a-premium-plugin | active | available | 1.2.3 | 2.3.4 | https://pluginsite.com/a-premium-plugin.2.3.4.zip?auth=yes123 |
+------------------+--------+-----------+---------+----------------+---------------------------------------------------------------+
The gist to get the URLs is:
/** @var array<string, string> $plugin_update_urls The plugin update download links keyed by plugin basename. */$plugin_update_urls = array();
/** * The plugin update data (which drives the yellow boxes on plugins.php). * * @see wp_update_plugins() * @see wp-includes/update.php * * @var stdClass{last_checked:string,response:array,translations:array,no_update:array,checked:array<string,string>} $plugin_updates */$plugin_updates = get_site_transient('update_plugins');
/** * Get all valid plugin update URLs. * * @var string $plugin_basename * @var stdClass{new_version:string, stable_version:string,name:string,slug:string,url:string,last_updated:string,homepage:string,package:string,download_link?:string,sections:stdClass{description:string,changelog?:string},banners:stdClass{high:string,low:string},icons:string} $values */foreach ($plugin_updates->responseas$plugin_basename => $values) {
if ( filter_var($values->package, FILTER_VALIDATE_URL) ) {
$plugin_update_urls[$plugin_basename] = $values->package;
}
}
I'm imagining running something like this on my local computer: wp plugin install $(wp plugin list --update=available --fields=update_url --ssh=production.com~/wp)
The text was updated successfully, but these errors were encountered:
Feature Request
Describe your use case and the problem you are facing
I would like to be able to list the download URLs for plugin updates. For premium plugins, where the licence key can only be used on one site, I need to get the authenticated download URL so I can download with cURL and test the plugin locally.
Currently this table can be generated:
$ wp plugin list --update=available --fields=name,status,update,version,update_version
Describe the solution you'd like
$ wp plugin list --update=available --fields=name,status,update,version,update_version,update_url
The gist to get the URLs is:
I'm imagining running something like this on my local computer:
wp plugin install $(wp plugin list --update=available --fields=update_url --ssh=production.com~/wp)
The text was updated successfully, but these errors were encountered: