示例#1
0
 /** 
  * charge la configuration de l'application
  * @access public static
  */
 public static function loadConf()
 {
     try {
         $bConfCacheEnabled = (int) self::getConfigVar('cache.conf.enabled');
         $sCacheFilename = self::getConfigVar('path.cache') . 'conf.php';
         if ($bConfCacheEnabled == 1 and file_exists($sCacheFilename)) {
             include $sCacheFilename;
             return;
         }
         $tConfigVar = self::$tConfigVar;
         foreach (self::$_tConfigFilename as $tConfig) {
             $sConfig = $tConfig[0];
             $sCatFilter = $tConfig[1];
             $tIni = array();
             $tIniBrut = parse_ini_file($sConfig, true);
             if ($sCatFilter != null) {
                 $tIni[$sCatFilter] = $tIniBrut[$sCatFilter];
             } else {
                 $tIni = $tIniBrut;
             }
             $tConfigVar = self::arrayMergeRecursive($tConfigVar, $tIni);
         }
         self::$tConfigVar = $tConfigVar;
         if ($bConfCacheEnabled == 1) {
             $sCodeCache = '<?php _root::$tConfigVar=' . var_export(self::$tConfigVar, true) . ';';
             file_put_contents($sCacheFilename, $sCodeCache);
         }
     } catch (Exception $e) {
         self::erreurLog($e->getMessage() . "\n" . $e->getTraceAsString());
     }
 }