-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Problem
Running the update subcommand deletes the contents of cloned plugin/theme folders.
A similar report was closed 4 years ago, but I think that should be reconsidered. I routinely run into this, and end up having to restore local changes from backups.
I have lots of sites in my dev environment, and most of those have lots of plugins. I can't memorize which ones are VCS and which aren't, so I have to manually check each one, and then update non-VCS plugins individually.
git clone git@github.com:WordPress/gutenberg.git(or any other plugin that's in the repository) andcdto it's foldergit checkout v8.0.0wp plugin update --all
Downloading update from https://downloads.wordpress.org/plugin/gutenberg.9.0.0.zip...
The authenticity of gutenberg.9.0.0.zip could not be verified as no signature was found.
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Warning: Could not remove the old plugin.
Plugin update failed.
+-----------+-------------+-------------+--------+
| name | old_version | new_version | status |
+-----------+-------------+-------------+--------+
| gutenberg | 8.0.0 | 9.0.0 | Error |
+-----------+-------------+-------------+--------+
Error: No plugins updated.The folder is now empty, and any work that was done locally is lost.
> ls
. .. node_modulesProposed Solution
The update subcommands aren't intended to work with VCS repos, so I think they should gracefully ignore them, rather than breaking them. An --include-vcs flag could override that for the rare time when someone does want to blow away a VCS checkout with the version from the w.org repo.
Environment
> wp cli info
OS: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
Shell: /bin/bash
PHP binary: /usr/local/Cellar/php/7.4.10/bin/php
PHP version: 7.4.10
php.ini used: /usr/local/etc/php/7.4/php-cli.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /Users/ian-work/vhosts/localhost/wp.test/public_html/content/plugins/gutenberg
WP-CLI packages dir: /Users/ian-work/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config: /Users/ian-work/vhosts/localhost/wp.test/wp-cli.yml
WP-CLI version: 2.4.0