# TODO configurable and detect changes by timestamp $compiled_file = File::buildPath(array($app_root, "cache", "{$basename}-compiled.php")); if (file_exists($compiled_file)) { global $config; require_once "{$compiled_file}"; return $config; } $file = File::buildPath(array($app_root, "{$basename}.yaml")); $fileenv = File::buildPath(array($app_root, "{$basename}-{$environment}.yaml")); $config = array(); if (file_exists($file)) { if ($env->debug) { self::$LOGGER->debug("Loading configuration file: {$file}"); } $loader = new DF_Web_Config_Loader($file); $config = array_merge($config, $loader->getConfig()); } if (file_exists($fileenv)) { if ($env->debug) { self::$LOGGER->log("Loading configuration file: {$fileenv}"); } $loader = DF_Web_Config_Loader($fileenv); $config = array_merge($config, $loader->getConfig()); } $struct = "<?php\n \$config = " . var_export($config, 1) . ";"; file_put_contents($compiled_file, $struct); return $config; } } DF_Web_Config::$LOGGER = DF_Web_Logger::logger('DF_Web_Config'); require_once 'DF/Util/Arrays.php';