Refactor database handling to require PostgreSQL connection, removing fallback to JSON. Implement error handling for database unavailability in key files. Update .env.example to reflect mandatory DATABASE_URL for local development. Remove Firebase configuration and related code from the project.

This commit is contained in:
2026-05-23 10:23:28 +02:00
parent 547778bba5
commit 6577db475a
20 changed files with 823 additions and 789 deletions
+6 -1
View File
@@ -1,6 +1,12 @@
<?php
require __DIR__ . '/helpers.php';
try {
$allRecipes = load_recipes();
} catch (DatabaseUnavailableException $e) {
handle_database_unavailable($e);
}
$lang = (isset($_GET['lang']) && strtolower($_GET['lang']) === 'de') ? 'de' : 'en';
$copy = [
'en' => [
@@ -46,7 +52,6 @@ $copy = [
];
$t = $copy[$lang];
$allRecipes = load_recipes();
$slug = isset($_GET['slug']) ? trim($_GET['slug']) : '';
$recipeRaw = $slug ? load_recipe_by_slug($slug) : null;
$recipe = $recipeRaw ? localize_recipe($recipeRaw, $lang) : null;