Varous improvements
This commit is contained in:
34
src/Config.php
Normal file
34
src/Config.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user