Varous improvements

This commit is contained in:
julien
2026-03-09 16:07:17 +01:00
parent edb1752f32
commit 03ce72ce00
7 changed files with 203 additions and 108 deletions

34
src/Config.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace App;
final class Config
{
public static function getTwigCache(bool $isDev): string|bool
{
if ($isDev) {
return false;
}
$path = __DIR__ . '/../var/cache/twig';
if (!is_dir($path)) {
@mkdir($path, 0755, true);
}
return $path;
}
public static function getDatabasePath(): string
{
$path = __DIR__ . '/../database/app.sqlite';
$dir = dirname($path);
if (!is_dir($dir)) {
@mkdir($dir, 0755, true);
}
if (!file_exists($path)) {
@touch($path);
@chmod($path, 0664);
}
return $path;
}
}