addArgument('name', InputArgument::REQUIRED, 'Name der Sicherung, etwa sicherung-20260912-181159.') ->addOption('force', null, InputOption::VALUE_NONE, 'Auch eine Sicherung aus einer neueren Fassung einspielen.'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $name = (string) $input->getArgument('name'); if ($input->isInteractive() && !$io->confirm(sprintf('Die Datenbank wird durch %s ersetzt. Fortfahren?', $name), false)) { $io->writeln('Abgebrochen. Es wurde nichts verändert.'); return Command::SUCCESS; } // The site says "come back later" while the database is being replaced. $this->updater->maintenance(true); $result = $this->backup->restore($name, (bool) $input->getOption('force')); foreach ($result['steps'] as $step) { $io->writeln(sprintf('%s %s: %s', $step['ok'] ? ' ok ' : ' FEHLER', $step['step'], $step['detail'])); } $this->updater->maintenance(false); if (!$result['ok']) { $io->error('Die Wiederherstellung ist nicht gelaufen. Die Installation ist unverändert.'); return Command::FAILURE; } $io->success('Wiederhergestellt. Prüfe jetzt die Website und räume danach den Cache: php bin/console cache:clear --env=prod'); return Command::SUCCESS; } }