Ask before installing user_migration; add the beta how-to
backup:user:backup and backup:user:restore now ask the administrator before installing or enabling user_migration (or take --install-user-migration), so nothing changes on the server without consent. The restore warns that user_migration imports only its allowlisted app settings. Also: a clear error for unknown locations instead of a raw database message; prune reports the number of affected users, not the number of kept ones; and --user-last rejects values that are not whole numbers. Adds docs/HOWTO.md and updates the README and PLAN.md for the beta.
This commit is contained in:
@@ -9,10 +9,12 @@ namespace OCA\NgBackup\Command;
|
||||
|
||||
use OCA\NgBackup\Service\TargetService;
|
||||
use OCA\NgBackup\Service\UserBackupService;
|
||||
use OCA\NgBackup\UserMigration\UserMigrationInstaller;
|
||||
use OCP\IUserManager;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
final class BackupUser extends Command {
|
||||
@@ -20,6 +22,7 @@ final class BackupUser extends Command {
|
||||
private TargetService $targets,
|
||||
private UserBackupService $userBackup,
|
||||
private IUserManager $userManager,
|
||||
private UserMigrationInstaller $installer,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -29,6 +32,7 @@ final class BackupUser extends Command {
|
||||
->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')
|
||||
->addOption('install-user-migration', null, InputOption::VALUE_NONE, 'Install and enable user_migration if it is missing (non-interactive consent)')
|
||||
->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
|
||||
@@ -47,6 +51,7 @@ HELP);
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
$this->installer->ensureEnabled($input, $output);
|
||||
$target = $this->targets->get($input->getArgument('target'));
|
||||
$manifest = $this->userBackup->backupUser($target, $user);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
Reference in New Issue
Block a user