aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Autooar
diff options
context:
space:
mode:
authorAdam Frisby2009-04-06 04:17:55 +0000
committerAdam Frisby2009-04-06 04:17:55 +0000
commit918c46688189cc0e6f237f9f2d2ee8892506d56d (patch)
treef047f3a3640b2ec57e9e0c6397aa008cf869cd98 /OpenSim/Region/OptionalModules/Autooar
parentChanged the asynchronous call to get inventory in HG, so that it properly rep... (diff)
downloadopensim-SC-918c46688189cc0e6f237f9f2d2ee8892506d56d.zip
opensim-SC-918c46688189cc0e6f237f9f2d2ee8892506d56d.tar.gz
opensim-SC-918c46688189cc0e6f237f9f2d2ee8892506d56d.tar.bz2
opensim-SC-918c46688189cc0e6f237f9f2d2ee8892506d56d.tar.xz
* Adds AutoOAR module, this will automatically OAR your regions every 20 minutes to a directory called "autooar", if enabled. Default disabled. Use [autooar] Enabled=true in OpenSim.ini to enable.
* Adds some MRM XMLDOC
Diffstat (limited to 'OpenSim/Region/OptionalModules/Autooar')
-rw-r--r--OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs72
1 files changed, 72 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs
new file mode 100644
index 0000000..6c10928
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs
@@ -0,0 +1,72 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using System.Timers;
6using Nini.Config;
7using OpenSim.Region.Framework.Interfaces;
8using OpenSim.Region.Framework.Scenes;
9
10namespace OpenSim.Region.OptionalModules.Autooar
11{
12 public class AutooarModule : IRegionModule
13 {
14 private readonly Timer m_timer = new Timer(60000*20);
15 private readonly List<Scene> m_scenes = new List<Scene>();
16 private IConfigSource config;
17 private bool m_enabled = false;
18
19
20 public void Initialise(Scene scene, IConfigSource source)
21 {
22 m_scenes.Add(scene);
23 config = source;
24 }
25
26 public void PostInitialise()
27 {
28 if(config.Configs["autooar"] != null)
29 {
30 m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled);
31 }
32
33 if(m_enabled)
34 {
35 m_timer.Elapsed += m_timer_Elapsed;
36 m_timer.AutoReset = true;
37 m_timer.Start();
38 }
39 }
40
41 void m_timer_Elapsed(object sender, ElapsedEventArgs e)
42 {
43 if (!Directory.Exists("autooars"))
44 Directory.CreateDirectory("autooars");
45
46 foreach (Scene scene in m_scenes)
47 {
48 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
49
50 archiver.ArchiveRegion(Path.Combine("autooars",
51 scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX +
52 "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz"));
53 }
54 }
55
56 public void Close()
57 {
58 if (m_timer.Enabled)
59 m_timer.Stop();
60 }
61
62 public string Name
63 {
64 get { return "Automatic OAR Module"; }
65 }
66
67 public bool IsSharedModule
68 {
69 get { return true; }
70 }
71 }
72}