From f86c438653fc3c8356a8f0c43a055b1928183f02 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 29 Nov 2010 08:43:33 -0800 Subject: Preservation of creator information now also working in IARs. Cleaned up usage help. Moved Osp around, deleted unnecessary OspInventoryWrapperPlugin, added manipulation of SOP's xml representation in a generic ExternalRepresentationUtils function. --- .../Inventory/Archiver/InventoryArchiverModule.cs | 54 +++++++++++++++++----- 1 file changed, 42 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 2eaca49..421ea30 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -75,6 +75,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver private Dictionary m_scenes = new Dictionary(); private Scene m_aScene; + private IUserAccountService m_UserAccountService; + protected IUserAccountService UserAccountService + { + get + { + if (m_UserAccountService == null) + // What a strange thing to do... + foreach (Scene s in m_scenes.Values) + { + m_UserAccountService = s.RequestModuleInterface(); + break; + } + + return m_UserAccountService; + } + } + + public InventoryArchiverModule() {} public InventoryArchiverModule(bool disablePresenceChecks) @@ -106,11 +124,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver scene.AddCommand( this, "save iar", - "save iar []", + "save iar [--p|-profile=] []", "Save user inventory archive (IAR).", " is the user's first name." + Environment.NewLine + " is the user's last name." + Environment.NewLine + " is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine + + "-p|--profile= adds the url of the profile service to the saved user information." + Environment.NewLine + " is the filesystem path at which to save the IAR." + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), HandleSaveInvConsoleCommand); @@ -157,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { try { - new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); + new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); } catch (EntryPointNotFoundException e) { @@ -197,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { try { - new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); + new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); } catch (EntryPointNotFoundException e) { @@ -368,10 +387,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) { Guid id = Guid.NewGuid(); - + + 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; }); + + List mainParams = ops.Parse(cmdparams); + try { - if (cmdparams.Length < 6) + if (mainParams.Count < 6) { m_log.Error( "[INVENTORY ARCHIVER]: usage is save iar []"); @@ -379,18 +406,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); - - string firstName = cmdparams[2]; - string lastName = cmdparams[3]; - string invPath = cmdparams[4]; - string pass = cmdparams[5]; - string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME); + if (options.ContainsKey("profile")) + m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -profile option if you want to produce a compatible IAR"); + + string firstName = mainParams[2]; + string lastName = mainParams[3]; + string invPath = mainParams[4]; + string pass = mainParams[5]; + string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); m_log.InfoFormat( "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", savePath, invPath, firstName, lastName); - ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary()); + ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); } catch (InventoryArchiverException e) { @@ -518,5 +547,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return false; } + } } -- cgit v1.1