diff --git a/.gitignore b/.gitignore index e04c219d90..af7e18beae 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ addon-modules/ bin/Debug/*.dll bin/*.dll.mdb bin/*.db +bin/*.db-journal bin/addin-db-* bin/*.dll bin/OpenSim.vshost.exe.config diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 574c9af769..863aa49b36 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void StartScripts() { - m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); +// m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); IScriptModule[] engines = RequestModuleInterfaces(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 431b90302a..7e781c3c62 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -493,7 +493,7 @@ namespace OpenSim.Region.Framework.Scenes if (!InventoryService.AddFolder(folder)) { m_log.WarnFormat( - "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", + "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", remoteClient.Name, remoteClient.AgentId); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 249946008b..fcc29536c9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3737,7 +3737,7 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", sp.Name, sp.UUID, RegionInfo.RegionName); - sp.ControllingClient.Close(); + sp.ControllingClient.Close(true); sp = null; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fa66858f06..c4b7b2702a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -342,7 +342,7 @@ namespace OpenSim.Region.Framework.Scenes public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) { - AddNewSceneObject(sceneObject, true, false); + AddNewSceneObject(sceneObject, attachToBackup, false); if (pos != null) sceneObject.AbsolutePosition = (Vector3)pos; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cfd4a51ccd..3e8c7e52b7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -974,7 +974,9 @@ namespace OpenSim.Region.Framework.Scenes { if (wasChild && HasAttachments()) { - m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); + m_log.DebugFormat( + "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); + // Resume scripts Util.FireAndForget(delegate(object x) { foreach (SceneObjectGroup sog in m_attachments) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0c7f49b126..5386a288c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5571,25 +5571,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// separated list. There is a space after /// each comma. /// - public LSL_String llList2CSV(LSL_List src) { - - string ret = String.Empty; - int x = 0; - m_host.AddScriptLPS(1); - if (src.Data.Length > 0) - { - ret = src.Data[x++].ToString(); - for (; x < src.Data.Length; x++) - { - ret += ", "+src.Data[x].ToString(); - } - } - - return ret; + return string.Join(", ", + (new List(src.Data)).ConvertAll(o => + { + return o.ToString(); + }).ToArray()); } /// diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 2d17977fce..9f05666d7e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -994,6 +994,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine // This delay exists to stop mono problems where script compilation and startup would stop the sim // working properly for the session. System.Threading.Thread.Sleep(m_StartDelay); + + m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name); } object[] o; @@ -1009,13 +1011,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (m_InitialStartup) if (scriptsStarted % 50 == 0) m_log.InfoFormat( - "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); + "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name); } } if (m_InitialStartup) m_log.InfoFormat( - "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); + "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name); // NOTE: Despite having a lockless queue, this lock is required // to make sure there is never no compile thread while there diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 7518b86f0b..deacd5a4b4 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -229,10 +229,28 @@ namespace OpenSim.Services.InventoryService public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); + + InventoryFolderBase rootFolder = GetRootFolder(principalID); + + if (rootFolder == null) + { + m_log.WarnFormat( + "[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}", + principalID, type); + + return null; + } + + return GetSystemFolderForType(rootFolder, type); + } + + private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) + { +// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); XInventoryFolder[] folders = m_Database.GetFolders( - new string[] { "agentID", "type"}, - new string[] { principalID.ToString(), ((int)type).ToString() }); + new string[] { "agentID", "parentFolderID", "type"}, + new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); if (folders.Length == 0) { @@ -308,22 +326,38 @@ namespace OpenSim.Services.InventoryService if (check != null) return false; - if (folder.Type == (short)AssetType.Folder - || folder.Type == (short)AssetType.Unknown - || folder.Type == (short)AssetType.OutfitFolder - || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null) + if (folder.Type != (short)AssetType.Folder || folder.Type != (short)AssetType.Unknown) { - XInventoryFolder xFolder = ConvertFromOpenSim(folder); - return m_Database.StoreFolder(xFolder); - } - else - { - m_log.WarnFormat( - "[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}", - folder.Type, folder.Name, folder.ParentID, folder.Owner); + InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); + + if (rootFolder == null) + { + m_log.WarnFormat( + "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}", + folder.Owner, folder.Type); + + return false; + } + + // Check we're not trying to add this as a system folder. + if (folder.ParentID == rootFolder.ID) + { + InventoryFolderBase existingSystemFolder + = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); + + if (existingSystemFolder != null) + { + m_log.WarnFormat( + "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}", + folder.Type, folder.Name, folder.ParentID, folder.Owner); + + return false; + } + } } - return false; + XInventoryFolder xFolder = ConvertFromOpenSim(folder); + return m_Database.StoreFolder(xFolder); } public virtual bool UpdateFolder(InventoryFolderBase folder)