diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 11d0c6527e..04f64c320f 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -34,6 +34,7 @@ using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic;
using System.Reflection;
//using System.Text;
+using System.Text.RegularExpressions;
using System.Threading;
using libsecondlife;
using log4net;
@@ -50,6 +51,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
protected Scene m_scene;
protected string m_savePath;
+
+ ///
+ /// Used for identifying uuids embedded in scripts
+ ///
+ protected static readonly Regex m_uuidRegex
+ = new Regex(
+ "[0-9a-eA-E]{8}-[0-9a-eA-E]{4}-[0-9a-eA-E]{4}-[0-9a-eA-E]{4}-[0-9a-eA-E]{12}",
+ RegexOptions.Compiled);
///
/// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
@@ -113,6 +122,31 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
return m_requestedObjectAsset;
}
+ ///
+ /// Record the asset uuids embedded within the given script.
+ ///
+ ///
+ /// Dictionary in which to record the references
+ protected void GetScriptAssetUuids(LLUUID scriptUuid, IDictionary assetUuids)
+ {
+ AssetBase scriptAsset = GetAsset(scriptUuid);
+
+ if (null != scriptAsset)
+ {
+ string script = Helpers.FieldToUTF8String(scriptAsset.Data);
+ m_log.DebugFormat("[ARCHIVER]: Script {0}", script);
+ MatchCollection uuidMatches = m_uuidRegex.Matches(script);
+ m_log.DebugFormat("[ARCHIVER]: Found {0} matches in script", uuidMatches.Count);
+
+ foreach (Match uuidMatch in uuidMatches)
+ {
+ LLUUID uuid = new LLUUID(uuidMatch.Value);
+ m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid);
+ assetUuids[uuid] = 1;
+ }
+ }
+ }
+
///
/// Record the uuids referenced by the given wearable asset
///
@@ -200,7 +234,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
GetWearableAssetUuids(tii.AssetID, assetUuids);
}
- if ((int)AssetType.Object == tii.Type)
+ else if ((int)AssetType.LSLText == tii.Type)
+ {
+ GetScriptAssetUuids(tii.AssetID, assetUuids);
+ }
+ else if ((int)AssetType.Object == tii.Type)
{
GetSceneObjectAssetUuids(tii.AssetID, assetUuids);
}