/** * Load properties to cache. */ protected static function LoadProperties() { self::$_PropertiesIds = array(); self::$_PropertiesNames = array(); if (Config::$UsePropertiesDiskCache && file_exists(VIRGO_API_DIR . "/properties_cache.bin")) { $h = fopen(VIRGO_API_DIR . "/properties_cache.bin", "r"); $buf = fread($h, filesize(VIRGO_API_DIR . "/properties_cache.bin")); fclose($h); $arr = unserialize($buf); foreach ($arr as $id => $vals) { $row = array('id' => $id, 'name' => $vals[0], 'date' => $vals[1]); $prop = self::BuildProperty($row); self::$_PropertiesIds[$prop->GetID()] = $prop; self::$_PropertiesNames[$prop->GetName()] = $prop; } } else { $result = DataBase::GetDbInstance()->ExecuteQuery("SELECT * FROM #S#properties"); while ($row = DataBase::GetDbInstance()->FetchArray($result)) { $prop = self::BuildProperty($row); self::$_PropertiesIds[$prop->GetID()] = $prop; self::$_PropertiesNames[$prop->GetName()] = $prop; } } }