Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

0.6.8-post-fixes
Melanie 2009-11-25 08:39:29 +00:00
commit 4fbdc538c7
13 changed files with 175 additions and 119 deletions

View File

@ -1294,14 +1294,7 @@ namespace OpenSim
{ {
try try
{ {
if (cmdparams.Length > 2) m_sceneManager.LoadArchiveToCurrentScene(cmdparams);
{
m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]);
}
else
{
m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME);
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -1315,14 +1308,7 @@ namespace OpenSim
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
protected void SaveOar(string module, string[] cmdparams) protected void SaveOar(string module, string[] cmdparams)
{ {
if (cmdparams.Length > 2) m_sceneManager.SaveCurrentSceneToArchive(cmdparams);
{
m_sceneManager.SaveCurrentSceneToArchive(cmdparams[2]);
}
else
{
m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME);
}
} }
private static string CombineParams(string[] commandParams, int pos) private static string CombineParams(string[] commandParams, int pos)

View File

@ -75,11 +75,6 @@ namespace OpenSim
/// </value> /// </value>
protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml";
/// <value>
/// The file used to load and save an opensimulator archive if no filename has been specified
/// </value>
protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar";
public ConfigSettings ConfigurationSettings public ConfigSettings ConfigurationSettings
{ {
get { return m_configSettings; } get { return m_configSettings; }

View File

@ -8130,8 +8130,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//lsrp.RequestData.RequestFlags; //lsrp.RequestData.RequestFlags;
//lsrp.RequestData.Filter; //lsrp.RequestData.Filter;
return true; // return true;
} }
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
{ {
RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
@ -8152,6 +8153,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
} }
private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack) private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack)
{ {

View File

@ -121,6 +121,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType; TarArchiveReader.TarEntryType entryType;
try
{
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{ {
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
@ -158,8 +161,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
} }
} }
}
finally
{
archive.Close(); archive.Close();
}
m_log.DebugFormat( m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",

View File

@ -118,18 +118,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
{ {
// We're almost done. Just need to write out the control file now
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
Exception reportedException = null; Exception reportedException = null;
bool succeeded = true; bool succeeded = true;
try try
{ {
// We're almost done. Just need to write out the control file now
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
m_archiveWriter.Close(); m_archiveWriter.Close();
} }
catch (IOException e) catch (Exception e)
{ {
m_saveStream.Close(); m_saveStream.Close();
reportedException = e; reportedException = e;
@ -261,8 +261,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
//inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
} }
if (null == inventoryFolder && null == inventoryItem)
{
// We couldn't find the path indicated
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage);
m_module.TriggerInventoryArchiveSaved(
m_id, false, m_userInfo, m_invPath, m_saveStream,
new Exception(errorMessage));
return;
}
m_archiveWriter = new TarArchiveWriter(m_saveStream); m_archiveWriter = new TarArchiveWriter(m_saveStream);
try
{
if (inventoryFolder != null) if (inventoryFolder != null)
{ {
m_log.DebugFormat( m_log.DebugFormat(
@ -280,20 +293,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH); SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH);
} }
else
{
// We couldn't find the path indicated
m_saveStream.Close();
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage);
m_module.TriggerInventoryArchiveSaved(
m_id, false, m_userInfo, m_invPath, m_saveStream,
new Exception(errorMessage));
return;
}
// Don't put all this profile information into the archive right now. // Don't put all this profile information into the archive right now.
//SaveUsers(); //SaveUsers();
}
catch (Exception)
{
m_archiveWriter.Close();
throw;
}
new AssetsRequest( new AssetsRequest(
new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys,

View File

@ -92,12 +92,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand( scene.AddCommand(
this, "load iar", this, "load iar",
"load iar <first> <last> <inventory path> <password> [<archive path>]", "load iar <first> <last> <inventory path> <password> [<archive path>]",
"Load user inventory archive. EXPERIMENTAL", HandleLoadInvConsoleCommand); "Load user inventory archive.", HandleLoadInvConsoleCommand);
scene.AddCommand( scene.AddCommand(
this, "save iar", this, "save iar",
"save iar <first> <last> <inventory path> <password> [<archive path>]", "save iar <first> <last> <inventory path> <password> [<archive path>]",
"Save user inventory archive. EXPERIMENTAL", HandleSaveInvConsoleCommand); "Save user inventory archive.", HandleSaveInvConsoleCommand);
m_aScene = scene; m_aScene = scene;
} }

View File

@ -104,13 +104,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
List<string> serialisedParcels = new List<string>(); List<string> serialisedParcels = new List<string>();
string filePath = "NONE"; string filePath = "NONE";
try
{
TarArchiveReader archive = new TarArchiveReader(m_loadStream); TarArchiveReader archive = new TarArchiveReader(m_loadStream);
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType; TarArchiveReader.TarEntryType entryType;
try
{
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{ {
//m_log.DebugFormat( //m_log.DebugFormat(
@ -152,8 +151,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
//m_log.Debug("[ARCHIVER]: Reached end of archive"); //m_log.Debug("[ARCHIVER]: Reached end of archive");
archive.Close();
} }
catch (Exception e) catch (Exception e)
{ {
@ -163,6 +160,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
return; return;
} }
finally
{
archive.Close();
}
m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);

View File

@ -79,6 +79,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected internal void ReceivedAllAssets( protected internal void ReceivedAllAssets(
ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
{
try
{
Save(assetsFoundUuids, assetsNotFoundUuids);
}
finally
{
m_archiveWriter.Close();
}
m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName);
m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty);
}
protected internal void Save(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
{ {
foreach (UUID uuid in assetsNotFoundUuids) foreach (UUID uuid in assetsNotFoundUuids)
{ {
@ -143,12 +159,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
m_archiveWriter.Close();
m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName);
m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty);
} }
/// <summary> /// <summary>

View File

@ -56,6 +56,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <summary> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
/// <param name="scene"></param>
/// <param name="savePath">The path to which to save data.</param>
/// <param name="requestId">The id associated with this request</param>
/// <exception cref="System.IO.IOException">
/// If there was a problem opening a stream for the file specified by the savePath
/// </exception>
public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId)
{ {
m_scene = scene; m_scene = scene;

View File

@ -45,6 +45,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private Scene m_scene; private Scene m_scene;
/// <value>
/// The file used to load and save an opensimulator archive if no filename has been specified
/// </value>
protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar";
public string Name public string Name
{ {
get { return "RegionArchiverModule"; } get { return "RegionArchiverModule"; }
@ -80,6 +85,38 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
} }
/// <summary>
/// Load a whole region from an opensimulator archive.
/// </summary>
/// <param name="cmdparams"></param>
public void HandleLoadOarConsoleCommand(string module, string[] cmdparams)
{
if (cmdparams.Length > 2)
{
DearchiveRegion(cmdparams[2]);
}
else
{
DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME);
}
}
/// <summary>
/// Save a region to a file, including all the assets needed to restore it.
/// </summary>
/// <param name="cmdparams"></param>
public void HandleSaveOarConsoleCommand(string module, string[] cmdparams)
{
if (cmdparams.Length > 2)
{
ArchiveRegion(cmdparams[2]);
}
else
{
ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME);
}
}
public void ArchiveRegion(string savePath) public void ArchiveRegion(string savePath)
{ {
ArchiveRegion(savePath, Guid.Empty); ArchiveRegion(savePath, Guid.Empty);

View File

@ -35,6 +35,9 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary> /// </summary>
public interface IRegionArchiverModule public interface IRegionArchiverModule
{ {
void HandleLoadOarConsoleCommand(string module, string[] cmdparams);
void HandleSaveOarConsoleCommand(string module, string[] cmdparams);
/// <summary> /// <summary>
/// Archive the region to the given path /// Archive the region to the given path
/// </summary> /// </summary>

View File

@ -241,24 +241,24 @@ namespace OpenSim.Region.Framework.Scenes
/// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets
/// as well as the details of the prims themselves. /// as well as the details of the prims themselves.
/// </summary> /// </summary>
/// <param name="filename"></param> /// <param name="cmdparams"></param>
public void SaveCurrentSceneToArchive(string filename) public void SaveCurrentSceneToArchive(string[] cmdparams)
{ {
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null) if (archiver != null)
archiver.ArchiveRegion(filename); archiver.HandleSaveOarConsoleCommand(string.Empty, cmdparams);
} }
/// <summary> /// <summary>
/// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload
/// their assets to the asset service. /// their assets to the asset service.
/// </summary> /// </summary>
/// <param name="filename"></param> /// <param name="cmdparams"></param>
public void LoadArchiveToCurrentScene(string filename) public void LoadArchiveToCurrentScene(string[] cmdparams)
{ {
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null) if (archiver != null)
archiver.DearchiveRegion(filename); archiver.HandleLoadOarConsoleCommand(string.Empty, cmdparams);
} }
public string SaveCurrentSceneMapToXmlString() public string SaveCurrentSceneMapToXmlString()

View File

@ -36,7 +36,8 @@ namespace OpenSim.Tools.LSL.Compiler
{ {
class Program class Program
{ {
private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; // Commented out because generated warning since m_positionMap could never be anything other than null
// private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap;
private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
static void Main(string[] args) static void Main(string[] args)
@ -210,16 +211,16 @@ namespace OpenSim.Tools.LSL.Compiler
sfs.Close(); sfs.Close();
string posmap = String.Empty; string posmap = String.Empty;
if (m_positionMap != null) // if (m_positionMap != null)
{ // {
foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in m_positionMap) // foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in m_positionMap)
{ // {
KeyValuePair<int, int> k = kvp.Key; // KeyValuePair<int, int> k = kvp.Key;
KeyValuePair<int, int> v = kvp.Value; // KeyValuePair<int, int> v = kvp.Value;
posmap += String.Format("{0},{1},{2},{3}\n", // posmap += String.Format("{0},{1},{2},{3}\n",
k.Key, k.Value, v.Key, v.Value); // k.Key, k.Value, v.Key, v.Value);
} // }
} // }
buf = enc.GetBytes(posmap); buf = enc.GetBytes(posmap);
@ -253,7 +254,8 @@ namespace OpenSim.Tools.LSL.Compiler
private static KeyValuePair<int, int> FindErrorPosition(int line, int col) private static KeyValuePair<int, int> FindErrorPosition(int line, int col)
{ {
return FindErrorPosition(line, col, m_positionMap); //return FindErrorPosition(line, col, m_positionMap);
return FindErrorPosition(line, col, null);
} }
private class kvpSorter : IComparer<KeyValuePair<int,int>> private class kvpSorter : IComparer<KeyValuePair<int,int>>