Support renaming multiple files at once

This commit is contained in:
Dane Everitt 2020-07-11 16:00:30 -07:00
parent 43f8ec23b8
commit 2653321fc2
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 35 additions and 29 deletions

View file

@ -109,11 +109,11 @@ class DaemonFileRepository extends DaemonRepository
/**
* Renames or moves a file on the remote machine.
*
* @param string $from
* @param string $to
* @param string|null $root
* @param array $files
* @return \Psr\Http\Message\ResponseInterface
*/
public function renameFile(string $from, string $to): ResponseInterface
public function renameFiles(?string $root, array $files): ResponseInterface
{
Assert::isInstanceOf($this->server, Server::class);
@ -121,8 +121,8 @@ class DaemonFileRepository extends DaemonRepository
sprintf('/api/servers/%s/files/rename', $this->server->uuid),
[
'json' => [
'rename_from' => urldecode($from),
'rename_to' => urldecode($to),
'root' => $root ?? '/',
'files' => $files,
],
]
);
@ -163,7 +163,7 @@ class DaemonFileRepository extends DaemonRepository
sprintf('/api/servers/%s/files/delete', $this->server->uuid),
[
'json' => [
'root' => $root,
'root' => $root ?? '/',
'files' => $files,
],
]