2024-11-02 20:17:40 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace OCA\OrganizationFolders\Command\OrganizationFolder;
|
|
|
|
|
|
|
|
use OCP\DB\Exception;
|
|
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
use OCA\OrganizationFolders\Command\BaseCommand;
|
|
|
|
|
2024-11-05 14:05:04 +01:00
|
|
|
class DeleteOrganizationFolder extends BaseCommand {
|
2024-11-02 20:17:40 +01:00
|
|
|
protected function configure(): void {
|
|
|
|
$this
|
2024-11-05 14:05:04 +01:00
|
|
|
->setName('organization-folders:delete')
|
|
|
|
->setDescription('Delete an organization folder')
|
2024-11-03 02:19:17 +01:00
|
|
|
->addArgument('id', InputArgument::REQUIRED, 'Id of the organization folder to remove');
|
2024-11-02 20:17:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
|
|
|
$id = (int)$input->getArgument('id');
|
|
|
|
|
|
|
|
try {
|
|
|
|
$this->organizationFolderService->remove($id);
|
|
|
|
|
|
|
|
$output->writeln("done");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
} catch (Exception $e) {
|
|
|
|
$output->writeln("<error>Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}</error>");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|