activate($request); } catch (Throwable $th) { throw new UnprocessableEntityException($th->getMessage()); } return new EmptyResponse(); } private function activate(ServerRequestInterface $request): void { $payload = $request->getParsedBody(); file_put_contents( $this->rootDir . '/LICENSE', $payload->license ); // Drop bkp tables $sm = $this->em->getConnection()->createSchemaManager(); $tables = $sm->listTableNames(); foreach ($tables as $table) { if (str_ends_with($table, '_bkp')) { $sm->dropTable($table); } } $menv = new Env($this->rootDir . '/.env'); $menv ->set('ENVIRONMENT', 'prod') ->set('DEBUG', false) ->save(); } }