From 5f7e392c7cc9410262dfb3333d9b60f6ff26eb79 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 10 Jan 2012 16:26:01 -0800 Subject: Add a check to see if an asset exists before recreating it while loading an archive. This does add an extra roundtrip to the asset server if loading new assets but it protects against overwriting (and potentially corrupting) existing assets. --- OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 587d260..edc5ba4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -404,6 +404,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver string extension = filename.Substring(i); string uuid = filename.Remove(filename.Length - extension.Length); + if (m_scene.AssetService.GetMetadata(uuid) != null) + { + // m_log.DebugFormat("[ARCHIVER]: found existing asset {0}",uuid); + return true; + } + if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) { sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; -- cgit v1.1 From 38db87475528f48752623fcb7e8b40ef728f50e9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 11 Jan 2012 14:33:26 +0000 Subject: If deserializing a scene object fails during IAR load then ignore the object rather than halting the IAR load with an exception. --- .../Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 6b24718..ee10d04 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -493,7 +493,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } else { - sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData)); + SceneObjectGroup deserializedObject = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); + + if (deserializedObject != null) + sceneObjects.Add(deserializedObject); } foreach (SceneObjectGroup sog in sceneObjects) -- cgit v1.1 From 8bdd80abfa3830142b16615d97d555dad417e08d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 12 Jan 2012 09:56:35 -0800 Subject: HG: normalize all externalized user ULRs to be the Home URL, i.e. the location of the user's UAS. This corrects an earlier design which had some cases pointing to the profile server. WARNING: CONFIGURATION CHANGES in both the sims (*Common.ini) and the Robust configs (Robust.HG.ini). Please check diff of the example files, but basically all vars that were pointing to profile should point to the UAS instead and should be called HomeURI. --- .../CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | 10 +++++----- .../Framework/InventoryAccess/HGInventoryAccessModule.cs | 9 ++++++--- OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 8 ++++++-- 3 files changed, 17 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index d20c9eb..eaadc1b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -55,16 +55,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // private Dictionary m_inventoryServers = new Dictionary(); private Scene m_scene; - private string m_ProfileServerURI; + private string m_HomeURI; #endregion #region Constructor - public HGAssetMapper(Scene scene, string profileURL) + public HGAssetMapper(Scene scene, string homeURL) { m_scene = scene; - m_ProfileServerURI = profileURL; + m_HomeURI = homeURL; } #endregion @@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess UUID.TryParse(meta.CreatorID, out uuid); UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); if (creator != null) - meta.CreatorID = m_ProfileServerURI + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName; + meta.CreatorID = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName; } } @@ -193,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (!hasCreatorData && creator != null) { XmlElement creatorData = doc.CreateElement("CreatorData"); - creatorData.InnerText = m_ProfileServerURI + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName; + creatorData.InnerText = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName; sop.AppendChild(creatorData); } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index bf24ebc..0c4ff7f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess get { return m_assMapper; } } - private string m_ProfileServerURI; + private string m_HomeURI; private bool m_OutboundPermission; private string m_ThisGatekeeper; @@ -84,7 +84,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; if (thisModuleConfig != null) { - m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); + // legacy configuration [obsolete] + m_HomeURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); + // preferred + m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI); m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty); } @@ -100,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return; base.AddRegion(scene); - m_assMapper = new HGAssetMapper(scene, m_ProfileServerURI); + m_assMapper = new HGAssetMapper(scene, m_HomeURI); scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index f44a3ba..0707cbe 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -125,8 +125,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver Dictionary options = new Dictionary(); OptionSet ops = new OptionSet(); -// ops.Add("v|version=", delegate(string v) { options["version"] = v; }); - ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); + + // legacy argument [obsolete] + ops.Add("p|profile=", delegate(string v) { Console.WriteLine("\n WARNING: -profile option is obsolete and it will not work. Use -home instead.\n"); }); + // preferred + ops.Add("h|home=", delegate(string v) { options["home"] = v; }); + ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; }); -- cgit v1.1 From 6214e6a217cfe206e127739b141bdcceb253c98d Mon Sep 17 00:00:00 2001 From: Bo Iwu Date: Thu, 12 Jan 2012 17:43:20 +0100 Subject: Allow update of stored entries within User Management Module-this is needed for proper work of HG friends. See http://opensimulator.org/mantis/view.php?id=5847 --- .../UserManagement/UserManagementModule.cs | 100 +++++++++++---------- 1 file changed, 52 insertions(+), 48 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 37292d6..2ad30a0 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -423,58 +423,62 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement AddUser(uuid, profileURL + ";" + first + " " + last); } - public void AddUser(UUID id, string creatorData) + public void AddUser (UUID id, string creatorData) { - lock (m_UserCache) - { - if (m_UserCache.ContainsKey(id)) - return; - } - -// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); - - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); - - if (account != null) - { - AddUser(id, account.FirstName, account.LastName); - } - else - { - UserData user = new UserData(); - user.Id = id; - user.Flags = -1; - user.Created = -1; - - if (creatorData != null && creatorData != string.Empty) - { - //creatorData = ; - - string[] parts = creatorData.Split(';'); - if (parts.Length >= 1) - { - user.HomeURL = parts[0]; - try - { - Uri uri = new Uri(parts[0]); - user.LastName = "@" + uri.Authority; - } - catch (UriFormatException) - { - m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); - user.LastName = "@unknown"; - } + UserData oldUser; + //lock the whole block - prevent concurrent update + lock (m_UserCache) { + m_UserCache.TryGetValue (id, out oldUser); + if (oldUser != null) { + if (creatorData == null || creatorData == String.Empty) { + //ignore updates without creator data + return; + } + //try update unknown users + //and creator's home URL's + if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) { + m_UserCache.Remove (id); +// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); + } else { + //we have already a valid user within the cache + return; } - if (parts.Length >= 2) - user.FirstName = parts[1].Replace(' ', '.'); } - else - { - user.FirstName = "Unknown"; - user.LastName = "User"; +// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); + + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes[0].RegionInfo.ScopeID, id); + + if (account != null) { + AddUser (id, account.FirstName, account.LastName); + } else { + UserData user = new UserData (); + user.Id = id; + user.Flags = -1; + user.Created = -1; + + if (creatorData != null && creatorData != string.Empty) { + //creatorData = ; + + string[] parts = creatorData.Split (';'); + if (parts.Length >= 1) { + user.HomeURL = parts[0]; + try { + Uri uri = new Uri (parts[0]); + user.LastName = "@" + uri.Authority; + } catch (UriFormatException) { + m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts[0]); + user.LastName = "@unknown"; + } + } + if (parts.Length >= 2) + user.FirstName = parts[1].Replace (' ', '.'); + } else { + user.FirstName = "Unknown"; + user.LastName = "User"; + } + + AddUserInternal (user); } - - AddUserInternal(user); } } -- cgit v1.1