public function init(VarStore $varStore) { $this->mainAppConfigSource = new IniFileConfigSource($varStore->requestFileFsPath(VarStore::CATEGORY_ETC, null, null, $this->appIniFileName)); $this->modules = array(); $etcFsPath = $varStore->requestDirFsPath(VarStore::CATEGORY_ETC, null, null); foreach ($etcFsPath->getChildDirectories() as $confDirPath) { $moduleNamespace = VarStore::dirNameToNamespace($confDirPath->getName()); $appConfigSource = null; if (is_file($appConfigFilePath = $confDirPath . DIRECTORY_SEPARATOR . $this->appIniFileName)) { $appConfigSource = new IniFileConfigSource($appConfigFilePath); } $moduleConfigSource = null; if (is_file($moduleConfigFilePath = $confDirPath . DIRECTORY_SEPARATOR . self::DEFAULT_MODULE_INI_FILE)) { $moduleConfigSource = new IniFileConfigSource($moduleConfigFilePath); } $this->modules[$moduleNamespace] = new LazyModule($moduleNamespace, $appConfigSource, $moduleConfigSource); } }
/** * {@inheritDoc} * @see \n2n\core\container\AppCache::lookupCacheStore($namespace) */ public function lookupCacheStore(string $namespace) : CacheStore { $dirFsPath = $this->dirFsPath->ext(VarStore::namespaceToDirName($namespace)); if (!$dirFsPath->isDir()) { $dirFsPath->mkdirs($this->dirPerm); } return new FileCacheStore($dirFsPath, $this->dirPerm, $this->filePerm); }