20240814#2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
return (new \Rmphp\Content\Content('/application/src/Infrastructure/templates/base.tpl'))->setSubtemplatePath('/application/src/Infrastructure/templates/')->setSubtemplatePathAlias([
|
||||
"main" => "/src/Main/Infrastructure/templates",
|
||||
"main" => "/src/Infrastructure/templates",
|
||||
]);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# Index
|
||||
- key: "/"
|
||||
routes:
|
||||
- action: "App\\Main\\Infrastructure\\Controllers\\IndexController"
|
||||
- action: "App\\Infrastructure\\Controllers\\IndexController"
|
||||
method: "index"
|
||||
params: ""
|
||||
|
||||
# Empty
|
||||
- key: "<@any>"
|
||||
routes:
|
||||
- action: "App\\Main\\Infrastructure\\Controllers\\IndexController"
|
||||
- action: "App\\nfrastructure\\Controllers\\IndexController"
|
||||
method: "emptyAction"
|
||||
params: ""
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
<?php
|
||||
|
||||
if(getenv("APP_MODE") == "PROD" && file_exists(dirname(__DIR__,3).'/var/routes/routes')){
|
||||
return unserialize(file_get_contents(dirname(__DIR__,3).'/var/routes/routes'));
|
||||
if(getenv("APP_MODE") == "PROD" && file_exists(dirname(__DIR__,3).'/var/routes/routes-main')){
|
||||
return unserialize(file_get_contents(dirname(__DIR__,3).'/var/routes/routes-main'));
|
||||
} else {
|
||||
$routesCollection = array_map(function ($routesFile){
|
||||
return file_get_contents($routesFile).PHP_EOL;
|
||||
}, array_merge(glob(__DIR__."/*/{*.yaml}", GLOB_BRACE), glob(__DIR__."/{*.yaml}", GLOB_BRACE)));
|
||||
}, glob(__DIR__."/{*.yaml}", GLOB_BRACE));
|
||||
|
||||
$routes = yaml_parse(implode($routesCollection));
|
||||
|
||||
if(getenv("APP_MODE") == "PROD") {
|
||||
if (!is_dir(dirname(__DIR__, 3).'/var/routes')) mkdir(dirname(__DIR__, 3).'/var/routes', 0777, true);
|
||||
file_put_contents(dirname(__DIR__, 3).'/var/routes/routes', serialize($routes));
|
||||
}
|
||||
if (!is_dir(dirname(__DIR__, 3).'/var/routes')) mkdir(dirname(__DIR__, 3).'/var/routes', 0777, true);
|
||||
file_put_contents(dirname(__DIR__, 3).'/var/routes/routes-main', serialize($routes));
|
||||
return $routes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user