Ejemplo n.º 1
0
 function GetServerList($flags = 0)
 {
     global $READER_DB;
     global $ADEI_VIRTUAL_READERS;
     echo "bla\r\n";
     print_r($READER_DB);
     echo "bla\r\n";
     if (!is_array($READER_DB)) {
         throw new ADEIException(translate("No data sources is configured"));
     }
     $list = array();
     foreach ($READER_DB as $db_id => &$db) {
         if ($flags & REQUEST::NEED_INFO) {
             $list[$db_id] = $db;
         } else {
             $list[$db_id] = array();
         }
         $list[$db_id]["name"] = $db["title"];
         $list[$db_id]["db_server_name"] = $db["title"];
         $list[$db_id]["db_server"] = $db_id;
     }
     /* Accepting all virtuals for now */
     if ($flags & REQUEST::SKIP_UNCACHED) {
         $cache = new CACHEDB();
         $cached_servers = $cache->ListCachedServers();
         foreach (array_keys($list) as $key) {
             if (!in_array($list[$key]['db_server'], $cached_servers)) {
                 unset($list[$key]);
             }
         }
     }
     if ($flags & REQUEST::LIST_VIRTUAL && is_array($ADEI_VIRTUAL_READERS)) {
         foreach ($ADEI_VIRTUAL_READERS as $db_id => &$db) {
             if ($flags & REQUEST::NEED_INFO) {
                 $list[$db_id] = $db;
             } else {
                 $list[$db_id] = array();
             }
             $list[$db_id]["name"] = $db["title"];
             $list[$db_id]["db_server_name"] = $db["title"];
             $list[$db_id]["db_server"] = $db_id;
             $list[$db_id]["virtual"] = true;
         }
     }
     return $list;
 }