ideas icon indicating copy to clipboard operation
ideas copied to clipboard

File operation that can be executed through WP-CLI pipes

Open schlessera opened this issue 7 years ago • 2 comments

As WP-CLI already stores connection strings and aliases to connect to servers, and as it is already required to be installed on servers for this to work, it would be great to add common file operations as WP-CLI commands.

As an example, let's consider rsync, a hugely useful remote synchronization tool. The main issue with this tool is that it is not a standard part of most servers, so if you want to use it, you have to install it on each server. What's more, you often need administrator access to servers to be able to install it, as it comes with a server daemon.

Having a command like wp files send|receive would allow one to use similar functionality without needing to install server-level tools.

wp @production files send <args> |  wp @staging files receive

Stuff to figure out:

  • How reliable is it to transfer binary files across pipes from differing servers/environments?
  • How can we have the two sides communicate to only send diffs instead of the entire file tree?

schlessera avatar May 28 '18 09:05 schlessera

Seems like a great way to be hacked.

joyously avatar May 28 '18 13:05 joyously

@joyously This can only be done if you have SSH access to the server (just as any other remote WP-CLI command execution). And if you already have SSH access to the server, you can do whatever you want with that server even without WP-CLI.

This is no different than having a cp command available on the server that you can execute through SSH.

schlessera avatar May 28 '18 14:05 schlessera