From 387f743993456bb7dbc6ea639bfa98db4567789c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Dec 2010 02:18:16 +0000 Subject: If we're saving an IAR with --profile information, then label this a version 1.0 IAR since it isn't compatible with older OpenSim releases. --- .../Archiver/InventoryArchiveWriteRequest.cs | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index cab341d..5e5f6c0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -156,7 +156,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The inventory folder to save /// The path to which the folder should be saved /// If true, save this folder itself. If false, only saves contents - protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, Dictionary options, IUserAccountService userAccountService) + /// + /// + protected void SaveInvFolder( + InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, + Dictionary options, IUserAccountService userAccountService) { if (saveThisFolderItself) { @@ -249,7 +253,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Write out control file. This has to be done first so that subsequent loaders will see this file first // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this - m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); + // not sure how to fix this though, short of going with a completely different file format. + m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile(options)); m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); if (inventoryFolder != null) @@ -372,12 +377,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } /// - /// Create the control file for a 0.1 version archive + /// Create the control file for the archive /// + /// /// - public static string Create0p1ControlFile() + public static string CreateControlFile(Dictionary options) { - int majorVersion = 0, minorVersion = 1; + int majorVersion, minorVersion; + + if (options.ContainsKey("profile")) + { + majorVersion = 1; + minorVersion = 0; + } + else + { + majorVersion = 0; + minorVersion = 1; + } m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); -- cgit v1.1 From b46de6e025f1179f13841e1a8ccb1031b598895b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Dec 2010 03:09:00 +0000 Subject: Remove the restriction that you have to be logged in when loading/saving iars This is pointless as we're supplying the password on the command line --- .../Inventory/Archiver/InventoryArchiverModule.cs | 128 ++++++++++----------- .../Archiver/Tests/InventoryArchiverTests.cs | 14 +-- 2 files changed, 70 insertions(+), 72 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b33c2b1..1e18095 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// Enable or disable checking whether the iar user is actually logged in /// - public bool DisablePresenceChecks { get; set; } +// public bool DisablePresenceChecks { get; set; } public event InventoryArchiveSaved OnInventoryArchiveSaved; @@ -95,10 +95,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public InventoryArchiverModule() {} - public InventoryArchiverModule(bool disablePresenceChecks) - { - DisablePresenceChecks = disablePresenceChecks; - } +// public InventoryArchiverModule(bool disablePresenceChecks) +// { +// DisablePresenceChecks = disablePresenceChecks; +// } public void Initialise(Scene scene, IConfigSource source) { @@ -172,8 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { try { new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); @@ -189,13 +189,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -212,8 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { try { new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); @@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -257,9 +257,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { - +// if (CheckPresence(userInfo.PrincipalID)) +// { InventoryArchiveReadRequest request; bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); @@ -280,13 +279,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } else m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", @@ -306,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { InventoryArchiveReadRequest request; bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); @@ -328,13 +327,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -529,28 +528,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } } - /// - /// Check if the given user is present in any of the scenes. - /// - /// The user to check - /// true if the user is in any of the scenes, false otherwise - protected bool CheckPresence(UUID userId) - { - if (DisablePresenceChecks) - return true; - - foreach (Scene scene in m_scenes.Values) - { - ScenePresence p; - if ((p = scene.GetScenePresence(userId)) != null) - { - p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); - return true; - } - } - - return false; - } - +// /// +// /// Check if the given user is present in any of the scenes. +// /// +// /// The user to check +// /// true if the user is in any of the scenes, false otherwise +// protected bool CheckPresence(UUID userId) +// { +// if (DisablePresenceChecks) +// return true; +// +// foreach (Scene scene in m_scenes.Values) +// { +// ScenePresence p; +// if ((p = scene.GetScenePresence(userId)) != null) +// { +// p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); +// return true; +// } +// } +// +// return false; +// } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 2747e15..76d0b85 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); @@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests //log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene Scene scene = SceneSetupHelpers.SetupScene("inventory"); @@ -443,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string humanEscapedItemName = @"You & you are a mean\/man\/"; string userPassword = "meowfood"; - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -558,7 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene Scene scene = SceneSetupHelpers.SetupScene("inventory"); @@ -619,7 +619,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); // SerialiserModule serialiserModule = new SerialiserModule(); - // InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + // InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene // Scene scene = SceneSetupHelpers.SetupScene(); -- cgit v1.1