setName('federation:sync-calendars') ->setDescription('Synchronize all incoming federated calendar shares'); } protected function execute(InputInterface $input, OutputInterface $output): int { $calendarCount = $this->federatedCalendarMapper->countAll(); if ($calendarCount === 0) { $output->writeln('There are no federated calendars'); return 0; } $progress = new ProgressBar($output, $calendarCount); $progress->start(); $calendars = $this->federatedCalendarMapper->findAll(); foreach ($calendars as $calendar) { try { $this->syncService->syncOne($calendar); } catch (\Exception $e) { $url = $calendar->getUri(); $msg = $e->getMessage(); $output->writeln("\nFailed to sync calendar $url: $msg"); } $progress->advance(); } $progress->finish(); $output->writeln(''); return 0; } }