Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Infrastructure\GeoIp;
|
||||
@@ -20,12 +21,12 @@ final class CountryDataService
|
||||
echo "Lade Länderdaten von RestCountries API...\n";
|
||||
|
||||
$jsonData = file_get_contents(self::RESTCOUNTRIES_API_URL);
|
||||
if (!$jsonData) {
|
||||
if (! $jsonData) {
|
||||
throw new RuntimeException('Konnte Länderdaten nicht herunterladen');
|
||||
}
|
||||
|
||||
$countries = json_decode($jsonData, true);
|
||||
if (!$countries) {
|
||||
if (! $countries) {
|
||||
throw new RuntimeException('Ungültige JSON-Daten erhalten');
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@ final class CountryDataService
|
||||
$country->nameEn,
|
||||
$country->nameDe,
|
||||
$country->nameNative,
|
||||
$country->updatedAt
|
||||
$country->updatedAt,
|
||||
]);
|
||||
$processed++;
|
||||
}
|
||||
@@ -57,11 +58,11 @@ final class CountryDataService
|
||||
|
||||
public function getCountryByCode(string $code): ?Country
|
||||
{
|
||||
$stmt = $this->database->prepare('SELECT * FROM countries WHERE code = ?');
|
||||
$stmt = $this->database->prepare('SELECT code, name_en, name_de, name_native, updated_at FROM countries WHERE code = ?');
|
||||
$stmt->execute([$code]);
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$result) {
|
||||
if (! $result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -79,13 +80,13 @@ final class CountryDataService
|
||||
$code = $countryData['cca2'] ?? null;
|
||||
$nameEn = $countryData['name']['common'] ?? null;
|
||||
|
||||
if (!$code || !$nameEn) {
|
||||
if (! $code || ! $nameEn) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$nameDe = $countryData['translations']['deu']['common'] ?? $nameEn;
|
||||
$nativeNames = $countryData['name']['nativeName'] ?? [];
|
||||
$nameNative = !empty($nativeNames)
|
||||
$nameNative = ! empty($nativeNames)
|
||||
? $nativeNames[array_key_first($nativeNames)]['common'] ?? $nameEn
|
||||
: $nameEn;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user