setName('backup:backup:user') ->setDescription('Back up one user via user_migration (account, settings, files and everything else a migrator covers)') ->addArgument('target', InputArgument::REQUIRED, 'Location name or id') ->addArgument('user', InputArgument::REQUIRED, 'User id') ->setHelp(<<<'HELP' Streams a user_migration export straight into the encrypted repository: no zip, no copy in the user's own storage. Shares data with the regular backup; this needs the user_migration app enabled. The manifest path this prints is what occ backup:restore:user expects. Example: occ backup:backup:user offsite alice HELP); } protected function execute(InputInterface $input, OutputInterface $output): int { $uid = (string)$input->getArgument('user'); $user = $this->userManager->get($uid); if ($user === null) { $output->writeln("No such user: $uid"); return 1; } try { $target = $this->targets->get($input->getArgument('target')); $manifest = $this->userBackup->backupUser($target, $user); } catch (\Throwable $e) { $output->writeln('' . $e->getMessage() . ''); return 1; } $output->writeln("Backed up $uid to $manifest."); return 0; } }