Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
dac8703949
|
@ -44,6 +44,7 @@ using OpenSim.Region.Framework.Scenes;
|
|||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
@ -536,6 +537,42 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
OSDArray texture_list = (OSDArray)request["texture_list"];
|
||||
SceneObjectGroup grp = null;
|
||||
|
||||
InventoryFolderBase textureUploadFolder = null;
|
||||
|
||||
List<InventoryFolderBase> foldersToUpdate = new List<InventoryFolderBase>();
|
||||
List<InventoryItemBase> itemsToUpdate = new List<InventoryItemBase>();
|
||||
IClientInventory clientInv = null;
|
||||
|
||||
if (texture_list.Count > 0)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
IClientAPI client = null;
|
||||
m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar);
|
||||
|
||||
if (avatar != null)
|
||||
{
|
||||
IClientCore core = (IClientCore)avatar.ControllingClient;
|
||||
|
||||
if (core.TryGet<IClientInventory>(out clientInv))
|
||||
{
|
||||
var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, AssetType.Texture);
|
||||
textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)AssetType.Unknown, systemTextureFolder.ID, 1);
|
||||
if (m_Scene.InventoryService.AddFolder(textureUploadFolder))
|
||||
{
|
||||
foldersToUpdate.Add(textureUploadFolder);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}",
|
||||
textureUploadFolder.Name, textureUploadFolder.ID, assetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
textureUploadFolder = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<UUID> textures = new List<UUID>();
|
||||
for (int i = 0; i < texture_list.Count; i++)
|
||||
{
|
||||
|
@ -543,6 +580,38 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
textureAsset.Data = texture_list[i].AsBinary();
|
||||
m_assetService.Store(textureAsset);
|
||||
textures.Add(textureAsset.FullID);
|
||||
|
||||
if (textureUploadFolder != null)
|
||||
{
|
||||
InventoryItemBase textureItem = new InventoryItemBase();
|
||||
textureItem.Owner = m_HostCapsObj.AgentID;
|
||||
textureItem.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||
textureItem.CreatorData = String.Empty;
|
||||
textureItem.ID = UUID.Random();
|
||||
textureItem.AssetID = textureAsset.FullID;
|
||||
textureItem.Description = assetDescription;
|
||||
textureItem.Name = assetName + " - Texture " + (i + 1).ToString();
|
||||
textureItem.AssetType = (int)AssetType.Texture;
|
||||
textureItem.InvType = (int)InventoryType.Texture;
|
||||
textureItem.Folder = textureUploadFolder.ID;
|
||||
textureItem.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
|
||||
textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
|
||||
textureItem.EveryOnePermissions = 0;
|
||||
textureItem.NextPermissions = (uint)PermissionMask.All;
|
||||
textureItem.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_Scene.InventoryService.AddItem(textureItem);
|
||||
itemsToUpdate.Add(textureItem);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}",
|
||||
textureItem.Name, textureItem.ID, assetName);
|
||||
}
|
||||
}
|
||||
|
||||
if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0))
|
||||
{
|
||||
clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray());
|
||||
}
|
||||
|
||||
for (int i = 0; i < mesh_list.Count; i++)
|
||||
|
|
|
@ -1874,8 +1874,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
// m_log.DebugFormat("[XXX] --> {0}", h);
|
||||
//m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle);
|
||||
if (agent.ChildrenCapSeeds.ContainsKey(region.RegionHandle))
|
||||
agent.ChildrenCapSeeds.Remove(region.RegionHandle);
|
||||
agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath);
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER]: Overwriting caps seed {0} with {1} for region {2} (handle {3}) for {4} in {5}",
|
||||
agent.ChildrenCapSeeds[region.RegionHandle], agent.CapsPath,
|
||||
region.RegionName, region.RegionHandle, sp.Name, Scene.Name);
|
||||
}
|
||||
|
||||
agent.ChildrenCapSeeds[region.RegionHandle] = agent.CapsPath;
|
||||
|
||||
if (sp.Scene.CapsModule != null)
|
||||
{
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
/// These conditions are heuristics to try and avoid taking a backup when the sim is busy.
|
||||
/// AutoBackupSkipAssets
|
||||
/// If true, assets are not saved to the oar file. Considerably reduces impact on simulator when backing up. Intended for when assets db is backed up separately
|
||||
/// AutoBackupKeepFilesForDays
|
||||
/// Backup files older than this value (in days) are deleted during the current backup process, 0 will disable this and keep all backup files indefinitely
|
||||
/// AutoBackupScript: String. Default: not specified (disabled).
|
||||
/// File path to an executable script or binary to run when an automatic backup is taken.
|
||||
/// The file should really be (Windows) an .exe or .bat, or (Linux/Mac) a shell script or binary.
|
||||
|
@ -429,6 +431,19 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
state.SkipAssets = tmpSkipAssets;
|
||||
}
|
||||
|
||||
// How long to keep backup files in days, 0 Disables this feature
|
||||
int tmpKeepFilesForDays = ResolveInt("AutoBackupKeepFilesForDays",
|
||||
this.m_defaultState.KeepFilesForDays, config, regionConfig);
|
||||
if (state == null && tmpKeepFilesForDays != this.m_defaultState.KeepFilesForDays)
|
||||
{
|
||||
state = new AutoBackupModuleState();
|
||||
}
|
||||
|
||||
if (state != null)
|
||||
{
|
||||
state.KeepFilesForDays = tmpKeepFilesForDays;
|
||||
}
|
||||
|
||||
// Set file naming algorithm
|
||||
string stmpNamingType = ResolveString("AutoBackupNaming",
|
||||
this.m_defaultState.NamingType.ToString(), config, regionConfig);
|
||||
|
@ -497,7 +512,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn(
|
||||
"BAD NEWS. You won't be able to save backups to directory " +
|
||||
"[AUTO BACKUP]: BAD NEWS. You won't be able to save backups to directory " +
|
||||
state.BackupDir +
|
||||
" because it doesn't exist or there's a permissions issue with it. Here's the exception.",
|
||||
e);
|
||||
|
@ -614,7 +629,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
bool heuristicsPassed = false;
|
||||
if (!this.m_timerMap.ContainsKey((Timer) sender))
|
||||
{
|
||||
m_log.Debug("Code-up error: timerMap doesn't contain timer " + sender);
|
||||
m_log.Debug("[AUTO BACKUP]: Code-up error: timerMap doesn't contain timer " + sender);
|
||||
}
|
||||
|
||||
List<IScene> tmap = this.m_timerMap[(Timer) sender];
|
||||
|
@ -650,6 +665,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
}
|
||||
this.DoRegionBackup(scene);
|
||||
}
|
||||
|
||||
// Remove Old Backups
|
||||
this.RemoveOldFiles(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -694,6 +712,31 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
iram.ArchiveRegion(savePath, guid, options);
|
||||
}
|
||||
|
||||
// For the given state, remove backup files older than the states KeepFilesForDays property
|
||||
private void RemoveOldFiles(AutoBackupModuleState state)
|
||||
{
|
||||
// 0 Means Disabled, Keep Files Indefinitely
|
||||
if (state.KeepFilesForDays > 0)
|
||||
{
|
||||
string[] files = Directory.GetFiles(state.BackupDir, "*.oar");
|
||||
DateTime CuttOffDate = DateTime.Now.AddDays(0 - state.KeepFilesForDays);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileInfo fi = new FileInfo(file);
|
||||
if (fi.CreationTime < CuttOffDate)
|
||||
fi.Delete();
|
||||
}
|
||||
catch (Exception Ex)
|
||||
{
|
||||
m_log.Error("[AUTO BACKUP]: Error deleting old backup file '" + file + "': " + Ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by the Event Manager when the OnOarFileSaved event is fired.
|
||||
/// </summary>
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
this.Timer = null;
|
||||
this.NamingType = NamingType.Time;
|
||||
this.Script = null;
|
||||
this.KeepFilesForDays = 0;
|
||||
}
|
||||
|
||||
public Dictionary<Guid, string> LiveRequests
|
||||
|
@ -116,6 +117,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
set;
|
||||
}
|
||||
|
||||
public int KeepFilesForDays
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public new string ToString()
|
||||
{
|
||||
string retval = "";
|
||||
|
|
Loading…
Reference in New Issue