Added checks
This commit is contained in:
@@ -14,9 +14,16 @@ use App\Repositories\PostRepository;
|
||||
use App\Services\HtmlSanitizer;
|
||||
use App\Services\HtmlPurifierFactory;
|
||||
use App\Database\Migration;
|
||||
use App\Bootstrap;
|
||||
use App\Routes;
|
||||
use App\Config;
|
||||
|
||||
// ============================================
|
||||
// Vérifier les répertoires
|
||||
// ============================================
|
||||
|
||||
Bootstrap::checkDirectories();
|
||||
|
||||
// ============================================
|
||||
// Charger les variables d'environnement
|
||||
// ============================================
|
||||
|
||||
26
src/Bootstrap.php
Normal file
26
src/Bootstrap.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
final class Bootstrap
|
||||
{
|
||||
public static function checkDirectories(): void
|
||||
{
|
||||
$dirs = [
|
||||
__DIR__ . '/../var/cache/twig',
|
||||
__DIR__ . '/../var/cache/htmlpurifier',
|
||||
__DIR__ . '/../var/logs',
|
||||
__DIR__ . '/../database',
|
||||
];
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
if (!is_dir($dir)) {
|
||||
if (!@mkdir($dir, 0755, true)) {
|
||||
throw new \RuntimeException("Impossible de créer le répertoire : {$dir}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user