/** * @param string $configFile name of the ini file to configure the framework * @param boolean $enableErrorHandler enable the error handler of jelix. * keep it to true, unless you have something to debug * and really have to use the default handler or an other handler */ function __construct($configFile, $enableErrorHandler = true) { global $gJCoord, $gJConfig; // temporary init. Remove this line when JELIX_APP_* support will be removed completely from Jelix jApp::initLegacy(); $gJCoord = $this; if ($enableErrorHandler) { set_error_handler('jErrorHandler'); set_exception_handler('JExceptionHandler'); } // load configuration data $gJConfig = jConfig::load($configFile); date_default_timezone_set($gJConfig->timeZone); $this->_loadPlugins(); }
/** * @param string $configFile name of the ini file to configure the framework */ function __construct($configFile) { global $gJCoord, $gJConfig; $gJCoord = $this; // load configuration data $gJConfig = jConfig::load($configFile); // set Error and exception handler // ne devrait être désactivé que lors de certains tests de jelix if ($gJConfig->use_error_handler) { set_error_handler('jErrorHandler'); set_exception_handler('JExceptionHandler'); } date_default_timezone_set($gJConfig->timeZone); $this->_loadPlugins(); }
/** * load and read the configuration of the application * The combination of all configuration files (the given file * and the mainconfig.ini.php) is stored * in a single temporary file. So it calls the jConfigCompiler * class if needed * @param string $configFile the config file name * @return object it contains all configuration options * @see jConfigCompiler */ public static function load($configFile) { $config = array(); $file = jApp::tempPath() . str_replace('/', '~', $configFile); if (BYTECODE_CACHE_EXISTS) { $file .= '.conf.php'; } else { $file .= '.resultini.php'; } self::$fromCache = true; if (!file_exists($file)) { // no cache, let's compile self::$fromCache = false; } else { $t = filemtime($file); $dc = jApp::mainConfigFile(); $lc = jApp::configPath('localconfig.ini.php'); if (file_exists($dc) && filemtime($dc) > $t || filemtime(jApp::configPath($configFile)) > $t || file_exists($lc) && filemtime($lc) > $t) { // one of the config files have been modified: let's compile self::$fromCache = false; } else { // let's read the cache file if (BYTECODE_CACHE_EXISTS) { include $file; $config = (object) $config; } else { $config = jelix_read_ini($file); } // we check all directories to see if it has been modified if ($config->compilation['checkCacheFiletime']) { foreach ($config->_allBasePath as $path) { if (!file_exists($path) || filemtime($path) > $t) { self::$fromCache = false; break; } } } } } if (!self::$fromCache) { require_once JELIX_LIB_CORE_PATH . 'jConfigCompiler.class.php'; return jConfigCompiler::readAndCache($configFile); } else { return $config; } }
/** * Load the configuration from the given file. * * Call it after initPaths * @param string|object $configFile name of the ini file to configure the framework or a configuration object * @param boolean $enableErrorHandler enable the error handler of jelix. * keep it to true, unless you have something to debug * and really have to use the default handler or an other handler */ public static function loadConfig($configFile, $enableErrorHandler = true) { if ($enableErrorHandler) { jBasicErrorHandler::register(); } if (is_object($configFile)) { self::setConfig($configFile); } else { self::setConfig(jConfig::load($configFile)); } self::$_config->enableErrorHandler = $enableErrorHandler; }
function jxs_init_jelix_env() { global $gJConfig; if (!$gJConfig) { $gJConfig = jConfig::load(JELIXS_APP_CONFIG_FILE); } }