Added ability to exclude inventory items or folders when saving IAR files.
parent
eced091689
commit
a366c05ae2
|
@ -146,6 +146,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
{
|
||||
if (options.ContainsKey("exclude"))
|
||||
{
|
||||
if (((List<String>)options["exclude"]).Contains(inventoryItem.Name) ||
|
||||
((List<String>)options["exclude"]).Contains(inventoryItem.ID.ToString()))
|
||||
{
|
||||
if (options.ContainsKey("verbose"))
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}",
|
||||
inventoryItem.Name, inventoryItem.ID, path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}",
|
||||
|
@ -178,6 +193,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself,
|
||||
Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
{
|
||||
if (options.ContainsKey("excludefolders"))
|
||||
{
|
||||
if (((List<String>)options["excludefolders"]).Contains(inventoryFolder.Name) ||
|
||||
((List<String>)options["excludefolders"]).Contains(inventoryFolder.ID.ToString()))
|
||||
{
|
||||
if (options.ContainsKey("verbose"))
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Skipping folder {0} at {1}",
|
||||
inventoryFolder.Name, path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
scene.AddCommand(
|
||||
"Archiving", this, "save iar",
|
||||
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
|
||||
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]",
|
||||
"Save user inventory archive (IAR).",
|
||||
"<first> is the user's first name.\n"
|
||||
+ "<last> is the user's last name.\n"
|
||||
|
@ -131,6 +131,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
+ string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME)
|
||||
+ "-h|--home=<url> adds the url of the profile service to the saved user information.\n"
|
||||
+ "-c|--creators preserves information about foreign creators.\n"
|
||||
+ "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine
|
||||
+ "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine
|
||||
+ "-v|--verbose extra debug messages.\n"
|
||||
+ "--noassets stops assets being saved to the IAR.",
|
||||
HandleSaveInvConsoleCommand);
|
||||
|
@ -398,6 +400,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; });
|
||||
ops.Add("c|creators", delegate(string v) { options["creators"] = v; });
|
||||
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
|
||||
ops.Add("e|exclude=", delegate(string v)
|
||||
{
|
||||
if (!options.ContainsKey("exclude"))
|
||||
options["exclude"] = new List<String>();
|
||||
((List<String>)options["exclude"]).Add(v);
|
||||
});
|
||||
ops.Add("f|excludefolder=", delegate(string v)
|
||||
{
|
||||
if (!options.ContainsKey("excludefolders"))
|
||||
options["excludefolders"] = new List<String>();
|
||||
((List<String>)options["excludefolders"]).Add(v);
|
||||
});
|
||||
|
||||
List<string> mainParams = ops.Parse(cmdparams);
|
||||
|
||||
|
@ -406,7 +420,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is save iar [-h|--home=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>] [-c|--creators] [-v|--verbose]");
|
||||
"[INVENTORY ARCHIVER]: save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue