From 1f87265bb6444e70dcb4032fccdb1875d3449a76 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 13 Oct 2026 10:23:36 -0100 Subject: [PATCH] feat(command): add --delete option to circles:remote Signed-off-by: Maxence Lange --- lib/Command/CirclesRemote.php | 8 +++++++- lib/Db/RemoteRequest.php | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Command/CirclesRemote.php b/lib/Command/CirclesRemote.php index 6e29066a1..65aab420b 100644 --- a/lib/Command/CirclesRemote.php +++ b/lib/Command/CirclesRemote.php @@ -67,6 +67,7 @@ protected function configure() { $this->setName('circles:remote') ->setDescription('remote features') ->addArgument('host', InputArgument::OPTIONAL, 'host of the remote instance of Nextcloud') + ->addOption('delete', '', InputOption::VALUE_NONE, 'delete the remote instance from database') ->addOption( 'type', '', InputOption::VALUE_REQUIRED, 'set type of remote', RemoteInstance::TYPE_UNKNOWN ) @@ -92,7 +93,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->output = $output; if ($host) { - $this->requestInstance($host); + if ($input->getOption('delete')) { + $this->remoteRequest->deleteInstance($host); + return 0; + } else { + $this->requestInstance($host); + } } else { $this->checkKnownInstance(); } diff --git a/lib/Db/RemoteRequest.php b/lib/Db/RemoteRequest.php index fb4ae0133..a0f2f73f1 100644 --- a/lib/Db/RemoteRequest.php +++ b/lib/Db/RemoteRequest.php @@ -239,6 +239,15 @@ public function searchDuplicate(RemoteInstance $remoteInstance): RemoteInstance return $this->getItemFromRequest($qb); } + /** + * @param RemoteInstance $remoteInstance + */ + public function deleteInstance(string $host) { + $qb = $this->getRemoteDeleteSql(); + $qb->limitToInstance($host); + $qb->executeStatement(); + } + /** * @param RemoteInstance $remoteInstance */