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:
+6
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user