accessContext = new ShareAccessContext(overrideChecks: true); } /** * @param Closure():Share $closure */ protected function wrapExecution(OutputInterface $output, Closure $closure): int { try { try { $this->dbConnection->beginTransaction(); $share = $closure(); $this->dbConnection->commit(); $output->writeln(json_encode($share->format($this->registry, $this->l10nFactory, $this->urlGenerator, $this->userManager), JSON_THROW_ON_ERROR)); return Base::SUCCESS; } catch (Exception $exception) { $this->dbConnection->rollBack(); throw $exception; } } catch (AShareException $aShareException) { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } $output->writeln($aShareException->getHint()); return Base::FAILURE; } } }