aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorH-H-H2015-05-01 19:30:56 +0100
committerMichael Cerquoni2015-05-04 15:53:31 -0400
commit49991d055a889f2bd082695383b664a40107db40 (patch)
treebe27f83758ab034369fed76f5981c8182aaaa0a8
parentMissing constants for llGetObjectDetails (diff)
downloadopensim-SC-49991d055a889f2bd082695383b664a40107db40.zip
opensim-SC-49991d055a889f2bd082695383b664a40107db40.tar.gz
opensim-SC-49991d055a889f2bd082695383b664a40107db40.tar.bz2
opensim-SC-49991d055a889f2bd082695383b664a40107db40.tar.xz
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>
-rw-r--r--OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs42
1 files changed, 40 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
index 28dc5f5..c17a368 100644
--- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
@@ -115,6 +115,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
115 115
116 private delegate T DefaultGetter<T>(string settingName, T defaultValue); 116 private delegate T DefaultGetter<T>(string settingName, T defaultValue);
117 private bool m_enabled; 117 private bool m_enabled;
118 private ICommandConsole m_console;
119 private List<Scene> m_Scenes = new List<Scene> ();
120
118 121
119 /// <summary> 122 /// <summary>
120 /// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState! 123 /// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState!
@@ -206,8 +209,20 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
206 /// Currently a no-op for AutoBackup because we have to wait for region to be fully loaded. 209 /// Currently a no-op for AutoBackup because we have to wait for region to be fully loaded.
207 /// </summary> 210 /// </summary>
208 /// <param name="scene"></param> 211 /// <param name="scene"></param>
209 void IRegionModuleBase.AddRegion(Scene scene) 212 void IRegionModuleBase.AddRegion (Scene scene)
210 { 213 {
214 if (!this.m_enabled) {
215 return;
216 }
217 lock (m_Scenes) {
218 m_Scenes.Add (scene);
219 }
220 m_console = MainConsole.Instance;
221
222 m_console.Commands.AddCommand (
223 "AutoBackup", false, "dobackup",
224 "dobackup",
225 "do backup.", DoBackup);
211 } 226 }
212 227
213 /// <summary> 228 /// <summary>
@@ -220,7 +235,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
220 { 235 {
221 return; 236 return;
222 } 237 }
223 238 m_Scenes.Remove (scene);
224 if (this.m_states.ContainsKey(scene)) 239 if (this.m_states.ContainsKey(scene))
225 { 240 {
226 AutoBackupModuleState abms = this.m_states[scene]; 241 AutoBackupModuleState abms = this.m_states[scene];
@@ -275,6 +290,29 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
275 290
276 #endregion 291 #endregion
277 292
293
294 private void DoBackup (string module, string[] args)
295 {
296 if (args.Length != 2) {
297 MainConsole.Instance.OutputFormat ("Usage: dobackup <regionname>");
298 return;
299 }
300 bool found = false;
301 string name = args [1];
302 lock (m_Scenes) {
303 foreach (Scene s in m_Scenes) {
304 string test = s.Name.ToString ();
305 if (test == name) {
306 found = true;
307 DoRegionBackup (s);
308 }
309 }
310 if (!found) {
311 MainConsole.Instance.OutputFormat ("No such region {0}. Nothing to backup", name);
312 }
313 }
314 }
315
278 /// <summary> 316 /// <summary>
279 /// Set up internal state for a given scene. Fairly complex code. 317 /// Set up internal state for a given scene. Fairly complex code.
280 /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene. 318 /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene.