pass all command parameters to load/save oar, not just the filename

unfortunately, these commands cannot yet be properly relocated to the region modules due to deficiencies in the region module infrastructure
0.6.8-post-fixes
Justin Clark-Casey (justincc) 2009-11-24 17:28:38 +00:00
parent 52952a75ca
commit 88ead9ee63
5 changed files with 49 additions and 28 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

@ -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

@ -34,7 +34,10 @@ namespace OpenSim.Region.Framework.Interfaces
/// Interface to region archive functionality /// Interface to region archive functionality
/// </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()