コード例 #1
0
ファイル: Delete.php プロジェクト: rchicoli/owncloud-core
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $mountId = $input->getArgument('mount_id');
     try {
         $mount = $this->globalService->getStorage($mountId);
     } catch (NotFoundException $e) {
         $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
         return 404;
     }
     $noConfirm = $input->getOption('yes');
     if (!$noConfirm) {
         $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
         $listInput = new ArrayInput([], $listCommand->getDefinition());
         $listInput->setOption('output', $input->getOption('output'));
         $listCommand->listMounts(null, [$mount], $listInput, $output);
         $questionHelper = $this->getHelper('question');
         $question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
         if (!$questionHelper->ask($input, $output, $question)) {
             return;
         }
     }
     $this->globalService->removeStorage($mountId);
 }