Adding the command <dobackup>to opensim console which requires a region name as an argument and will do an oar of that region if the autobackup module is enabled
Signed-off-by: Michael Cerquoni <nebadon2025@gmail.com>inv-download
parent
382e05df14
commit
49991d055a
|
@ -115,6 +115,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
||||||
|
|
||||||
private delegate T DefaultGetter<T>(string settingName, T defaultValue);
|
private delegate T DefaultGetter<T>(string settingName, T defaultValue);
|
||||||
private bool m_enabled;
|
private bool m_enabled;
|
||||||
|
private ICommandConsole m_console;
|
||||||
|
private List<Scene> m_Scenes = new List<Scene> ();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState!
|
/// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState!
|
||||||
|
@ -208,6 +211,18 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
void IRegionModuleBase.AddRegion (Scene scene)
|
void IRegionModuleBase.AddRegion (Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!this.m_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lock (m_Scenes) {
|
||||||
|
m_Scenes.Add (scene);
|
||||||
|
}
|
||||||
|
m_console = MainConsole.Instance;
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand (
|
||||||
|
"AutoBackup", false, "dobackup",
|
||||||
|
"dobackup",
|
||||||
|
"do backup.", DoBackup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -220,7 +235,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_Scenes.Remove (scene);
|
||||||
if (this.m_states.ContainsKey(scene))
|
if (this.m_states.ContainsKey(scene))
|
||||||
{
|
{
|
||||||
AutoBackupModuleState abms = this.m_states[scene];
|
AutoBackupModuleState abms = this.m_states[scene];
|
||||||
|
@ -275,6 +290,29 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
private void DoBackup (string module, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 2) {
|
||||||
|
MainConsole.Instance.OutputFormat ("Usage: dobackup <regionname>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool found = false;
|
||||||
|
string name = args [1];
|
||||||
|
lock (m_Scenes) {
|
||||||
|
foreach (Scene s in m_Scenes) {
|
||||||
|
string test = s.Name.ToString ();
|
||||||
|
if (test == name) {
|
||||||
|
found = true;
|
||||||
|
DoRegionBackup (s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
MainConsole.Instance.OutputFormat ("No such region {0}. Nothing to backup", name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set up internal state for a given scene. Fairly complex code.
|
/// Set up internal state for a given scene. Fairly complex code.
|
||||||
/// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene.
|
/// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene.
|
||||||
|
|
Loading…
Reference in New Issue