function initDataProvider($connection = false)
{
    global $CONFIG, $DB_CONNECTOR, $CM;
    if (!empty($CONFIG["gl_datprov"])) {
        if (!defined("DB_PREFIX")) {
            define("DB_PREFIX", $CONFIG["gl_db_prefix"]);
        }
        $DB_CONNECTOR = new DBManager($CONFIG["gl_db_user"], $CONFIG["gl_db_pass"], $CONFIG["gl_db_host"], $CONFIG["gl_db_name"], $CONFIG["gl_db_prefix"]);
        if (!empty($CONFIG["gl_db_ext"])) {
            DBManager::$Extension = $CONFIG["gl_db_ext"];
        }
        if ($DB_CONNECTOR->InitConnection()) {
            $connection = true;
        }
    }
    if (!defined("DB_CONNECTION")) {
        define("DB_CONNECTION", $connection);
    }
    if ($connection) {
        loadDatabaseConfig(false, $CONFIG["gl_db_prefix"]);
        if (!isset($CONFIG["gl_caen"])) {
            $CONFIG["gl_caen"] = 1;
        }
        if (!isServerSetup() && !is("IN_API") && CacheManager::CachingAvailable($CONFIG["gl_caen"]) !== false) {
            $gttl = min($CONFIG["poll_frequency_clients"], $CONFIG["poll_frequency_tracking"]) * 2;
            $sttl = !empty($CONFIG["gl_st_upin"]) ? $CONFIG["gl_st_upin"] : 3600;
            $CM = new CacheManager(md5(SUBSITEHOST . $CONFIG["gl_lzid"] . $CONFIG["gl_db_prefix"] . $CONFIG["gl_db_pass"] . $CONFIG["gl_db_user"] . $CONFIG["gl_db_name"]), $gttl, array(111 => array("VISITOR", 512), 112 => array("EVENTS", 128), 113 => array("INTERNAL", 256, $gttl * 2), 114 => array("GROUPS", 256, $gttl * 2), 115 => array("FILTERS", 128, $gttl * 2), 116 => array("DBCNF", 128, $gttl * 2), 117 => array("STATS", 1, $sttl), 118 => array("DUT", 1)));
            $CM->Read();
        }
        loadDatabaseConfig(true, $CONFIG["gl_db_prefix"]);
    }
    return $connection;
}
 static function InitCacheManager()
 {
     if (CacheManager::CachingAvailable(Server::$Configuration->File["gl_caen"]) !== false) {
         $gttl = min(Server::$Configuration->File["poll_frequency_clients"], Server::$Configuration->File["poll_frequency_tracking"]) * 2;
         $tttl = abs(min(Server::$Configuration->File["timeout_clients"], Server::$Configuration->File["timeout_chats"]) - 5);
         $sttl = !empty(Server::$Configuration->File["gl_st_upin"]) ? Server::$Configuration->File["gl_st_upin"] : 3600;
         $static_ttl = 3600;
         CacheManager::$ActiveManager = new CacheManager(md5(SUBSITEHOST . Server::$Configuration->File["gl_lzid"] . Server::$Configuration->File["gl_db_prefix"] . Server::$Configuration->File["gl_db_pass"] . Server::$Configuration->File["gl_db_user"] . Server::$Configuration->File["gl_db_name"]), $gttl, array(DATA_CACHE_KEY_VISITORS => array("VISITOR", 512), DATA_CACHE_KEY_EVENTS => array("EVENTS", 128, $static_ttl), DATA_CACHE_KEY_OPERATORS => array("INTERNAL", 256, $tttl, true), DATA_CACHE_KEY_GROUPS => array("GROUPS", 256, $tttl, true), DATA_CACHE_KEY_FILTERS => array("FILTERS", 128, $static_ttl, true), DATA_CACHE_KEY_DBCONFIG => array("DBCNF", 128, $static_ttl), DATA_CACHE_KEY_STATS => array("STATS", 1, $sttl, true), DATA_CACHE_KEY_DATA_TIMES => array("DUT", 1, $static_ttl)));
         CacheManager::$ActiveManager->Read();
     }
 }