20250303#2

This commit is contained in:
User
2025-03-03 14:25:44 +03:00
parent fee7f1466c
commit 70810412f4
20 changed files with 25 additions and 28 deletions

16
config/routes/routes.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
$cashFile = preg_replace("'.config.*$'",'', __DIR__).'/var/routes/'.md5(__FILE__);
if(getenv("APP_MODE") == "PROD" && file_exists($cashFile)){
return unserialize(file_get_contents($cashFile));
} else {
$routesCollection = array_map(function ($routesFile){
return file_get_contents($routesFile).PHP_EOL;
}, glob(__DIR__."/{*.yaml}", GLOB_BRACE));
$routes = yaml_parse(implode($routesCollection));
if (!is_dir(dirname($cashFile))) mkdir(dirname($cashFile), 0777, true);
file_put_contents($cashFile, serialize($routes));
return $routes;
}