From df9afe1f3460badb514284ea42c6df9b29462133 Mon Sep 17 00:00:00 2001 From: Orka Arnest CRUZE Date: Wed, 23 Oct 2024 12:19:50 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20publication=20capabilities=20et=20m?= =?UTF-8?q?=C3=A9tadonn=C3=A9es=20WMS-raster/WMTS=20#470?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entrepot/PyramidRasterController.php | 16 ++++++++++++++-- src/Services/CapabilitiesService.php | 2 -- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Controller/Entrepot/PyramidRasterController.php b/src/Controller/Entrepot/PyramidRasterController.php index 3324f100..07e06f9c 100644 --- a/src/Controller/Entrepot/PyramidRasterController.php +++ b/src/Controller/Entrepot/PyramidRasterController.php @@ -161,8 +161,13 @@ public function addWmsRasterWmts( // Création ou mise à jour du capabilities try { - if (ConfigurationTypes::WMSRASTER === $configuration['type'] || StoredDataTypes::ROK4_PYRAMID_RASTER === $pyramid['type']) { + if (ConfigurationTypes::WMSRASTER === $configuration['type']) { $this->capabilitiesService->createOrUpdate($datastoreId, $endpoint, $offering['urls'][0]['url']); + } elseif (ConfigurationTypes::WMTSTMS === $configuration['type'] && StoredDataTypes::ROK4_PYRAMID_RASTER === $pyramid['type']) { + $offeringUrl = array_values(array_filter($offering['urls'], fn ($url) => 'WMTS' === $url['type']))[0] ?? null; + if (null !== $offeringUrl) { + $this->capabilitiesService->createOrUpdate($datastoreId, $endpoint, $offeringUrl['url']); + } } } catch (\Exception $e) { } @@ -227,7 +232,14 @@ public function editWmsRasterWmts( // Création ou mise à jour du capabilities try { - $this->capabilitiesService->createOrUpdate($datastoreId, $endpoint, $offering['urls'][0]['url']); + if (ConfigurationTypes::WMSRASTER === $configuration['type']) { + $this->capabilitiesService->createOrUpdate($datastoreId, $endpoint, $offering['urls'][0]['url']); + } elseif (ConfigurationTypes::WMTSTMS === $configuration['type'] && StoredDataTypes::ROK4_PYRAMID_RASTER === $pyramid['type']) { + $offeringUrl = array_values(array_filter($offering['urls'], fn ($url) => 'WMTS' === $url['type']))[0] ?? null; + if (null !== $offeringUrl) { + $this->capabilitiesService->createOrUpdate($datastoreId, $endpoint, $offeringUrl['url']); + } + } } catch (\Exception $e) { } diff --git a/src/Services/CapabilitiesService.php b/src/Services/CapabilitiesService.php index cb556c29..5a2bfb38 100644 --- a/src/Services/CapabilitiesService.php +++ b/src/Services/CapabilitiesService.php @@ -81,8 +81,6 @@ public function createOrUpdate(string $datastoreId, array $endpoint, string $url $annexe = $this->annexeApiService->add($datastoreId, $filePath, [$path], ['type=capabilities']); } - $this->fs->remove($filePath); - return $annexe; }