|
|
@@ -34,6 +34,7 @@ use Elastica\Param;
|
|
|
use libphonenumber\NumberParseException;
|
|
|
use libphonenumber\PhoneNumberUtil;
|
|
|
use Psr\Log\LoggerInterface;
|
|
|
+use Symfony\Component\HttpFoundation\Response;
|
|
|
use Symfony\Component\String\ByteString;
|
|
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
|
|
use Symfony\Contracts\Service\Attribute\Required;
|
|
|
@@ -172,24 +173,33 @@ class OrganizationFactory
|
|
|
throw $e;
|
|
|
}
|
|
|
|
|
|
- // Création du site typo3
|
|
|
+ // Register the subdomain into the BindFile (takes up to 5min to take effect)
|
|
|
+ $this->bindFileService->registerSubdomain($subdomain->getSubdomain());
|
|
|
+ $this->logger->info("Subdomain registered");
|
|
|
+
|
|
|
+ // Création du site typo3 (on est obligé d'attendre que l'organisation soit persistée en base)
|
|
|
if ($organizationCreationRequest->getCreateWebsite()) {
|
|
|
$response = $this->typo3Service->createSite($organization->getId());
|
|
|
-
|
|
|
- // TODO: revoir l'utilité du champs cmsId
|
|
|
$rootPageUid = json_decode($response->getContent(), true);
|
|
|
- $organization->setCmsId($rootPageUid);
|
|
|
- $this->entityManager->persist($organization);
|
|
|
- $this->entityManager->flush();
|
|
|
- $this->logger->info("New typo3 website created (root uid : " . $rootPageUid . ")");
|
|
|
+
|
|
|
+ if (
|
|
|
+ $response->getStatusCode() === Response::HTTP_OK ||
|
|
|
+ !$rootPageUid
|
|
|
+ ) {
|
|
|
+ // TODO: revoir l'utilité du champs cmsId
|
|
|
+ $organization->setCmsId($rootPageUid);
|
|
|
+ $this->entityManager->persist($organization);
|
|
|
+ $this->entityManager->flush();
|
|
|
+ $this->logger->info("New typo3 website created (root uid : " . $rootPageUid . ")");
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $this->logger->critical("/!\ A critical error happened while creating the Typo3 website ");
|
|
|
+ $this->logger->debug($response->getContent());
|
|
|
+ }
|
|
|
} else {
|
|
|
$this->logger->warning("Typo3 website creation was not required");
|
|
|
}
|
|
|
|
|
|
- // Register the subdomain into the BindFile (takes up to 5min to take effect)
|
|
|
- $this->bindFileService->registerSubdomain($subdomain->getSubdomain());
|
|
|
- $this->logger->info("Subdomain registered");
|
|
|
-
|
|
|
return $organization;
|
|
|
}
|
|
|
|