add ability for load iar/save iar to take in arbitrary options
not used for anything yetsoprefactor
parent
0526d3a535
commit
72bd68a21f
|
@ -30,11 +30,11 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using NDesk.Options;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
@ -92,7 +92,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
scene.AddCommand(
|
||||
this, "load iar",
|
||||
"load iar <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
//"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
"Load user inventory archive (IAR).",
|
||||
//"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
|
||||
//+ "<first> is user's first name." + Environment.NewLine
|
||||
"<first> is user's first name." + Environment.NewLine
|
||||
+ "<last> is user's last name." + Environment.NewLine
|
||||
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
|
||||
|
@ -134,7 +137,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
|
||||
{
|
||||
return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -172,7 +183,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, string savePath)
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -211,6 +224,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
}
|
||||
|
||||
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
|
||||
{
|
||||
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -252,7 +272,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath)
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, string loadPath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -300,26 +322,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="cmdparams"></param>
|
||||
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
|
||||
{
|
||||
if (cmdparams.Length < 6)
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
|
||||
|
||||
List<string> mainParams = optionSet.Parse(cmdparams);
|
||||
|
||||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
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 loadPath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
string firstName = mainParams[2];
|
||||
string lastName = mainParams[3];
|
||||
string invPath = mainParams[4];
|
||||
string pass = mainParams[5];
|
||||
string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
||||
loadPath, invPath, firstName, lastName);
|
||||
|
||||
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath))
|
||||
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
||||
loadPath, firstName, lastName);
|
||||
|
@ -351,7 +378,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
savePath, invPath, firstName, lastName);
|
||||
|
||||
Guid id = Guid.NewGuid();
|
||||
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath);
|
||||
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
|
||||
|
||||
lock (m_pendingConsoleSaves)
|
||||
m_pendingConsoleSaves.Add(id);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
|
@ -60,6 +61,20 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
|
||||
|
||||
/// <summary>
|
||||
/// Dearchive a user's inventory folder from the given stream
|
||||
/// </summary>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
|
||||
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
|
||||
/// <param name="options">Dearchiving options. At the moment, the only option is ("merge", true). This merges
|
||||
/// the loaded IAR with existing folders where possible.</param>
|
||||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
Dictionary<string, object> options);
|
||||
|
||||
/// <summary>
|
||||
/// Archive a user's inventory folder to the given stream
|
||||
/// </summary>
|
||||
|
@ -70,5 +85,19 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
||||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
|
||||
|
||||
/// <summary>
|
||||
/// Archive a user's inventory folder to the given stream
|
||||
/// </summary>
|
||||
/// <param name="id">ID representing this request. This will later be returned in the save event</param>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="invPath">The inventory path from which the inventory should be saved.</param>
|
||||
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
||||
/// <param name="options">Archiving options. Currently, there are none.</param>
|
||||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Dictionary<string, object> options);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue