Skip to content

Commit d36e01e

Browse files
authored
Merge pull request #983 from nextcloud/feat/add-option-to-disable-on-export
feat: Add option to disable user before export from occ
2 parents 89ebee0 + dd1b475 commit d36e01e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/Command/Export.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ protected function configure(): void {
5555
'Comma-separated list of data type ids, pass <comment>--types=none</comment> to only export base user data',
5656
false,
5757
)
58+
->addOption(
59+
'disable',
60+
mode: InputOption::VALUE_NONE,
61+
description: 'Disable the user before starting the export.',
62+
)
5863
->addArgument(
5964
'user',
6065
InputArgument::REQUIRED,
@@ -154,6 +159,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
154159
$partSuffix = '.part';
155160
$exportPath = "$folder/$exportName.zip$partSuffix";
156161

162+
if ($input->getOption('disable')) {
163+
$user->setEnabled(false);
164+
$io->writeln('User ' . $user->getUID() . ' was disabled');
165+
}
166+
157167
$resource = fopen($exportPath, 'w');
158168
$exportDestination = new ExportDestination($resource, $exportPath);
159169
$this->migrationService->export($exportDestination, $user, $selectedMigrators, $io);

0 commit comments

Comments
 (0)