protected static function loadProfiles() { $file = App::configPath('profiles.ini.php'); $tempFile = App::tempPath('profiles.cache.php'); if (!file_exists($tempFile) || filemtime($file) > filemtime($tempFile)) { $compiler = new \jProfilesCompiler($file); self::$_profiles = $compiler->compile(); \Jelix\IniFile\Util::write(self::$_profiles, $tempFile); } else { self::$_profiles = parse_ini_file($tempFile, true); } }
/** * Identical to read(), but also stores the result in a temporary file * @return object an object which contains configuration values */ public function readAndCache() { $config = $this->read(false); $tempPath = App::tempPath(); \jFile::createDir($tempPath, $config->chmodDir); $filename = $tempPath . str_replace('/', '~', $this->configFileName); if (BYTECODE_CACHE_EXISTS) { $filename .= '.conf.php'; if ($f = @fopen($filename, 'wb')) { fwrite($f, '<?php $config = ' . var_export(get_object_vars($config), true) . ";\n?>"); fclose($f); chmod($filename, $config->chmodFile); } else { throw new Exception('Error while writing configuration cache file -- ' . $filename); } } else { IniFileMgr::write(get_object_vars($config), $filename . '.resultini.php', ";<?php die('');?>\n", '', $config->chmodFile); } return $config; }