Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

slimupdates2
Melanie 2010-05-10 03:57:44 +01:00
commit 3e8ceb3509
17 changed files with 74 additions and 38 deletions

View File

@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(
"SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id",
"SELECT name, description, assetType, local, temporary, asset_flags, data FROM assets WHERE id=?id",
dbcon))
{
cmd.Parameters.AddWithValue("?id", assetID.ToString());
@ -133,6 +133,7 @@ namespace OpenSim.Data.MySQL
asset.Local = false;
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
}
}
}
@ -345,7 +346,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id");
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon);
cmd.Parameters.AddWithValue("?id", id);
cmd.ExecuteNonQuery();

View File

@ -975,7 +975,7 @@ namespace OpenSim.Data.MySQL
"use_estate_sun, fixed_sun, sun_position, " +
"covenant, Sandbox, sunvectorx, sunvectory, " +
"sunvectorz, loaded_creation_datetime, " +
"loaded_creation_id) values (?RegionUUID, ?BlockTerraform, " +
"loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " +
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
"?AllowLandResell, ?AllowLandJoinDivide, " +
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
@ -989,7 +989,8 @@ namespace OpenSim.Data.MySQL
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
"?SunPosition, ?Covenant, ?Sandbox, " +
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
"?LoadedCreationDateTime, ?LoadedCreationID)";
"?LoadedCreationDateTime, ?LoadedCreationID, " +
"?TerrainImageID)";
FillRegionSettingsCommand(cmd, rs);
@ -1276,6 +1277,8 @@ namespace OpenSim.Data.MySQL
else
newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
return newSettings;
}
@ -1596,6 +1599,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
}

View File

@ -0,0 +1,3 @@
BEGIN;
ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
{
private static NullRegionData Instance = null;
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>();
@ -62,12 +62,14 @@ namespace OpenSim.Data.Null
{
if (regionName.Contains("%"))
{
if (r.RegionName.Contains(regionName.Replace("%", "")))
string cleanname = regionName.Replace("%", "");
m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower());
if (r.RegionName.ToLower().Contains(cleanname.ToLower()))
ret.Add(r);
}
else
{
if (r.RegionName == regionName)
if (r.RegionName.ToLower() == regionName.ToLower())
ret.Add(r);
}
}

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -44,10 +44,10 @@ namespace OpenSim.Data.SQLite
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count";
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID from assets limit :start, :count";
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)";
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, asset_flags, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Flags, :Data)";
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, asset_flags=:Flags, Data=:Data where UUID=:UUID";
private const string assetSelect = "select * from assets";
private SqliteConnection m_conn;
@ -136,6 +136,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Flags", asset.Flags));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
@ -154,6 +155,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Flags", asset.Flags));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
@ -227,7 +229,8 @@ namespace OpenSim.Data.SQLite
asset.Description = (String) row["Description"];
asset.Local = Convert.ToBoolean(row["Local"]);
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
asset.Data = (byte[]) row["Data"];
asset.Flags = (AssetFlags)Convert.ToInt32(row["asset_flags"]);
asset.Data = (byte[])row["Data"];
return asset;
}
@ -240,6 +243,7 @@ namespace OpenSim.Data.SQLite
metadata.Description = (string) row["Description"];
metadata.Type = Convert.ToSByte(row["Type"]);
metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct.
metadata.Flags = (AssetFlags)Convert.ToInt32(row["asset_flags"]);
// Current SHA1s are not stored/computed.
metadata.SHA1 = new byte[] {};

View File

@ -1156,6 +1156,7 @@ namespace OpenSim.Data.SQLite
createCol(regionsettings, "fixed_sun", typeof (Int32));
createCol(regionsettings, "sun_position", typeof (Double));
createCol(regionsettings, "covenant", typeof(String));
createCol(regionsettings, "map_tile_ID", typeof(String));
regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
return regionsettings;
}
@ -1474,6 +1475,7 @@ namespace OpenSim.Data.SQLite
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
newSettings.Covenant = new UUID((String) row["covenant"]);
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
return newSettings;
}
@ -1792,6 +1794,7 @@ namespace OpenSim.Data.SQLite
row["fixed_sun"] = settings.FixedSun;
row["sun_position"] = settings.SunPosition;
row["covenant"] = settings.Covenant.ToString();
row["map_tile_ID"] = settings.TerrainImageID.ToString();
}
/// <summary>

View File

@ -36,10 +36,10 @@ namespace OpenSim.Framework
[Flags]
public enum AssetFlags : int
{
Normal = 0,
Maptile = 1,
Rewritable = 2,
Collectable = 4
Normal = 0, // Immutable asset
Maptile = 1, // What it says
Rewritable = 2, // Content can be rewritten
Collectable = 4 // Can be GC'ed after some time
}
/// <summary>

View File

@ -349,7 +349,7 @@ namespace OpenSim
// moved these here as the terrain texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(false);
scene.CreateTerrainTexture();
// TODO : Try setting resource for region xstats here on scene
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));

View File

@ -121,6 +121,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
UUID textureID;
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
{
//m_log.DebugFormat("[GETTEXTURE]: {0}", textureID);
AssetBase texture;
if (!String.IsNullOrEmpty(REDIRECT_URL))
@ -167,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture)
{
string range = request.Headers.GetOne("Range");
//m_log.DebugFormat("[GETTEXTURE]: Range {0}", range);
if (!String.IsNullOrEmpty(range))
{
// Range request

View File

@ -197,7 +197,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if (grinfo != null)
{
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionsByName {0} found {1} regions", name, grinfo.Count);
rinfo.AddRange(grinfo);
foreach (GridRegion r in grinfo)
if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
rinfo.Add(r);
}
return rinfo;

View File

@ -1000,7 +1000,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
return responsemap;
}
public void LazySaveGeneratedMaptile(byte[] data, bool temporary)
public void RegenerateMaptile(byte[] data)
{
// Overwrites the local Asset cache with new maptile data
// Assets are single write, this causes the asset server to ignore this update,
@ -1010,7 +1010,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// map tile while protecting the (grid) asset database from bloat caused by a new asset each
// time a mapimage is generated!
UUID lastMapRegionUUID = m_scene.RegionInfo.lastMapUUID;
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
int lastMapRefresh = 0;
int twoDays = 172800;
@ -1030,21 +1030,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
}
UUID TerrainImageUUID = UUID.Random();
if (lastMapRegionUUID == UUID.Zero || (lastMapRefresh + RefreshSeconds) < Util.UnixTimeSinceEpoch())
{
m_scene.RegionInfo.SaveLastMapUUID(TerrainImageUUID);
m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE");
}
else
{
TerrainImageUUID = lastMapRegionUUID;
m_log.Debug("[MAPTILE]: REUSING OLD MAPTILE IMAGE ID");
}
m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID;
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
AssetBase asset = new AssetBase(
m_scene.RegionInfo.RegionSettings.TerrainImageID,
@ -1053,8 +1041,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scene.RegionInfo.RegionID.ToString());
asset.Data = data;
asset.Description = m_scene.RegionInfo.RegionName;
asset.Temporary = temporary;
asset.Temporary = false;
asset.Flags = AssetFlags.Maptile;
// Store the new one
m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
m_scene.AssetService.Store(asset);
m_scene.RegionInfo.RegionSettings.Save();
// Delete the old one
m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastMapRegionUUID);
m_scene.AssetService.Delete(lastMapRegionUUID.ToString());
}
private void MakeRootAgent(ScenePresence avatar)

View File

@ -29,6 +29,6 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface IWorldMapModule
{
void LazySaveGeneratedMaptile(byte[] data, bool temporary);
void RegenerateMaptile(byte[] data);
}
}

View File

@ -1823,7 +1823,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Create a terrain texture for this scene
/// </summary>
public void CreateTerrainTexture(bool temporary)
public void CreateTerrainTexture()
{
//create a texture asset of the terrain
IMapImageGenerator terrain = RequestModuleInterface<IMapImageGenerator>();
@ -1841,7 +1841,9 @@ namespace OpenSim.Region.Framework.Scenes
IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
if (mapModule != null)
mapModule.LazySaveGeneratedMaptile(data, temporary);
mapModule.RegenerateMaptile(data);
else
m_log.DebugFormat("[SCENE]: MapModule is null, can't save maptile");
}
}

View File

@ -156,6 +156,7 @@ namespace OpenSim.Services.AssetService
public bool Delete(string id)
{
m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
UUID assetID;
if (!UUID.TryParse(id, out assetID))
return false;
@ -165,7 +166,11 @@ namespace OpenSim.Services.AssetService
return false;
if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
{
return m_Database.Delete(id);
}
else
m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
return false;
}

View File

@ -324,6 +324,7 @@ namespace OpenSim.Services.GridService
if (rdatas != null)
{
m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
foreach (RegionData rdata in rdatas)
{
if (count++ < maxNumber)
@ -331,7 +332,7 @@ namespace OpenSim.Services.GridService
}
}
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains(".")))
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)) && name.Contains("."))
{
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name);
if (r != null)