43 public static function startProd(array &$config): void {
54 $cacheD = \ROOT . \DS . ($config[
'cache'][
'directory'] ??=
'cache' . \DS);
55 $cacheSystem = $config[
'cache'][
'system'] ??
'Ubiquity\\cache\\system\\ArrayCache';
56 self::$cache =
new $cacheSystem($cacheD,
'.cache', $config[
'cache'][
'params'] ?? []);
60 if (! isset(self::$cache)) {
61 $cacheSystem = $config[
'cache'][
'system'] ??
'Ubiquity\\cache\\system\\ArrayCache';
62 $cacheParams = $config[
'cache'][
'params'] ?? [];
64 self::$cache =
new $cacheSystem($cacheDirectory, $postfix, $cacheParams);
76 return self::$cacheDirectory;
85 return \ROOT . \DS . self::$cacheDirectory;
95 return \ROOT . \DS . self::$cacheDirectory . \DS . $subDirectory;
105 $routes = self::getControllerCache();
106 return \array_merge($routes, self::getControllerCache(
true));
118 protected static function _getFiles(array &$config,
string $type,
bool $silent =
false,?
string $domain=
null): array {
120 $domainBase=Startup::getActiveDomainBase();
122 $domainBase=DDDManager::getDomainBase($domain);
124 $typeNS = $domainBase.($config[
'mvcNS'][$type])??$type;
125 $typeDir = \ROOT . \DS . \str_replace(
"\\", \DS, $typeNS);
127 echo \ucfirst($type) .
' directory is ' . \realpath($typeDir) .
"\n";
129 return UFileSystem::glob_recursive($typeDir . \DS .
'*.php');
140 protected static function _getAllFiles(array &$config,
string $type,
bool $silent =
false): array {
143 foreach ($domains as $domain){
144 $result=\array_merge($result,self::_getFiles($config,$type,$silent,$domain));
146 $result=\array_merge($result, self::_getFiles($config,$type,$silent,
''));
Manager for caches (Router, Rest, models).
static getCacheInstance(array &$config, string $cacheDirectory, string $postfix)
static _getFiles(array &$config, string $type, bool $silent=false,?string $domain=null)
Returns an array of files from type $type.
static startProdFromCtrl()
Starts the cache from a controller.
static getCacheSubDirectory(string $subDirectory)
Returns an absolute cache subdirectory.
static startProd(array &$config)
Starts the cache for production.
static _getAllFiles(array &$config, string $type, bool $silent=false)
Returns an array of all files from type $type.
static getAllRoutes()
Returns an array of all defined routes, included REST routes.
static getCacheDirectory()
Returns the relative cache directory.
static getAbsoluteCacheDirectory()
Returns the absolute cache directory.
This class is responsible for storing Arrays in PHP files.
static initialGetCacheDirectory(array &$config)
Ubiquity\cache\traits$DevRouterCacheTrait This class is part of Ubiquity.
Ubiquity\cache\traits$ModelsCacheTrait This class is part of Ubiquity.
Manager for a Domain Driven Design approach.
File system utilities Ubiquity\utils\base$UFileSystem This class is part of Ubiquity.