Example #1
0
 /**
  * initilizes the rex_config class.
  */
 protected static function init()
 {
     if (self::$initialized) {
         return;
     }
     define('REX_CONFIG_FILE_CACHE', rex_path::coreCache('config.cache'));
     // take care, so we are able to write a cache file on shutdown
     // (check here, since exceptions in shutdown functions are not visible to the user)
     $dir = dirname(REX_CONFIG_FILE_CACHE);
     rex_dir::create($dir);
     if (!is_writable($dir)) {
         throw new rex_exception('rex-config: cache dir "' . dirname(REX_CONFIG_FILE_CACHE) . '" is not writable!');
     }
     // save cache on shutdown
     register_shutdown_function([__CLASS__, 'save']);
     self::load();
     self::$initialized = true;
 }