aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Command
diff options
context:
space:
mode:
authorTobia De Koninck <LEDfan@users.noreply.github.com>2020-01-03 08:43:39 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-02-03 11:15:56 +0100
commit7c56144f4927ed56d02c197710833c2b10c2f65d (patch)
tree7e83aa441d61636403136d8e7cc4f5864154ef57 /apps/files/lib/Command
parent411058e47cd42871b2099190ac67f47b9bd17e30 (diff)
downloadnextcloud-server-7c56144f4927ed56d02c197710833c2b10c2f65d.tar.gz
nextcloud-server-7c56144f4927ed56d02c197710833c2b10c2f65d.zip
Add option to transfer-ownership to move data
This will move the home folder of own user to another user. Only allowed if that other user's home folder is empty. Can be used as workaround to rename users. Signed-off-by: Tobia De Koninck <LEDfan@users.noreply.github.com>
Diffstat (limited to 'apps/files/lib/Command')
-rw-r--r--apps/files/lib/Command/TransferOwnership.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index cad1b1b46cb..2675a7dd1bb 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -77,7 +77,12 @@ class TransferOwnership extends Command {
InputOption::VALUE_REQUIRED,
'selectively provide the path to transfer. For example --path="folder_name"',
''
- );
+ )->addOption(
+ 'move',
+ null,
+ InputOption::VALUE_NONE,
+ 'move data from source user to root directory of destination user, which must be empty'
+ );
}
protected function execute(InputInterface $input, OutputInterface $output) {
@@ -99,7 +104,8 @@ class TransferOwnership extends Command {
$sourceUserObject,
$destinationUserObject,
ltrim($input->getOption('path'), '/'),
- $output
+ $output,
+ $input->getOption('move') === true
);
} catch (TransferOwnershipException $e) {
$output->writeln("<error>" . $e->getMessage() . "</error>");