public static function init() { self::$config = FileCache::get('config'); if (!self::$config) { self::loadXml($_SERVER['DOCUMENT_ROOT'] . '/' . Config::configPath()); } }
/** * When you initialize the library, the configuration defined in "oauthconf.xml" file of the gid_client is loaded * and by default this method auto-sync data (client_token, access_token,...) with server * * @param string $gid_client GID Client to load * @param boolean $sync Indicates if automatic data synchronization with the server is enabled * @param string $ini_path path of the configuration of the library (druid.ini file) if no argument passed, the default path and file will be /config/druid.ini * @throws Exception */ public static function init($gid_client = 'default', $sync = true, $ini_path = null) { try { if (!self::$initialized) { if (!isset($ini_path)) { $ini_path = dirname(__FILE__) . '/../config/druid.ini'; } Config::$ini_path = $ini_path; self::$initialized = true; AutoloaderClass::init(); // Init config library Config::init($gid_client, $ini_path); // Initialize Logger, if we create 'gidlog' cookie, we enabled log. if (Config::logLevel() === 'OFF' && !isset($_COOKIE['gidlog'])) { include_once dirname(__FILE__) . '/core/log4php/LoggerEmpty.php'; } else { if (!class_exists('Logger')) { include_once dirname(__FILE__) . '/core/log4php/Logger.php'; } \Logger::configure('main', new LogConfig(Config::logLevel(), Config::logPath())); } self::$logger = \Logger::getLogger("main"); // Initialize Cache. FileCache::init(Config::cachePath(), Config::environment()); // Initialize OAuth Config OAuthConfig::init(); self::$gid_things = new Things(); if ($sync) { self::synchronizeSessionWithServer(); } } } catch (Exception $e) { self::$logger->error($e->getMessage()); throw $e; } }