35 lines
711 B
PHP
35 lines
711 B
PHP
<?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;
|
|
}
|
|
}
|