addArgument( 'uid', InputArgument::REQUIRED, 'User who owns the calendar subscription' ) ->addArgument( 'uri', InputArgument::REQUIRED, 'URI of the calendar to be deleted' ); } protected function execute(InputInterface $input, OutputInterface $output): int { $user = (string)$input->getArgument('uid'); if (!$this->userManager->userExists($user)) { throw new \InvalidArgumentException("User $user is unknown"); } $uri = (string)$input->getArgument('uri'); if ($uri === '') { throw new \InvalidArgumentException('Specify the URI of the calendar to be deleted'); } $subscriptionInfo = $this->calDavBackend->getSubscriptionByUri( 'principals/users/' . $user, $uri ); if ($subscriptionInfo === null) { throw new \InvalidArgumentException("User $user has no calendar subscription with the URI $uri"); } $subscription = new CachedSubscription( $this->calDavBackend, $subscriptionInfo, ); $subscription->delete(); $output->writeln("Calendar subscription with the URI $uri for user $user deleted"); return self::SUCCESS; } }