aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorSean McNamara2011-02-19 22:08:19 -0500
committerSean McNamara2011-02-19 22:08:19 -0500
commit99e82602826e7d100d04a4bb229188be240db1ad (patch)
tree7fc03bea7bd15bf648da6db56ba4d0895fe8ed52 /OpenSim/Region/OptionalModules
parentLet GetNextFile do all the string-building work for SEQUENTIAL. (diff)
downloadopensim-SC_OLD-99e82602826e7d100d04a4bb229188be240db1ad.zip
opensim-SC_OLD-99e82602826e7d100d04a4bb229188be240db1ad.tar.gz
opensim-SC_OLD-99e82602826e7d100d04a4bb229188be240db1ad.tar.bz2
opensim-SC_OLD-99e82602826e7d100d04a4bb229188be240db1ad.tar.xz
Add [Modules] option for unconditionally disabling entire module globally (for easy configuration)
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs25
1 files changed, 24 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
index f8d9060..7593b95 100644
--- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
@@ -40,6 +40,9 @@ using OpenSim.Region.Framework.Interfaces;
40 40
41/* 41/*
42 * Config Settings Documentation. 42 * Config Settings Documentation.
43 * At the TOP LEVEL, e.g. in OpenSim.ini, we have one option:
44 * In the [Modules] section:
45 * AutoBackupModule: True/False. Default: False. If True, use the auto backup module. Otherwise it will be disabled regardless of what settings are in Regions.ini!
43 * EACH REGION in e.g. Regions/Regions.ini can have the following options: 46 * EACH REGION in e.g. Regions/Regions.ini can have the following options:
44 * AutoBackup: True/False. Default: False. If True, activate auto backup functionality. 47 * AutoBackup: True/False. Default: False. If True, activate auto backup functionality.
45 * This is the only required option for enabling auto-backup; the other options have sane defaults. 48 * This is the only required option for enabling auto-backup; the other options have sane defaults.
@@ -166,6 +169,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
166 readonly Dictionary<IScene, AutoBackupModuleState> states = new Dictionary<IScene, AutoBackupModuleState>(4); 169 readonly Dictionary<IScene, AutoBackupModuleState> states = new Dictionary<IScene, AutoBackupModuleState>(4);
167 readonly Dictionary<double, Timer> timers = new Dictionary<double, Timer>(1); 170 readonly Dictionary<double, Timer> timers = new Dictionary<double, Timer>(1);
168 readonly Dictionary<Timer, List<IScene>> timerMap = new Dictionary<Timer, List<IScene>>(1); 171 readonly Dictionary<Timer, List<IScene>> timerMap = new Dictionary<Timer, List<IScene>>(1);
172 private bool m_Enabled = false; //Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState!
169 173
170 public AutoBackupModule () 174 public AutoBackupModule ()
171 { 175 {
@@ -175,11 +179,24 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
175 #region IRegionModuleBase implementation 179 #region IRegionModuleBase implementation
176 void IRegionModuleBase.Initialise (Nini.Config.IConfigSource source) 180 void IRegionModuleBase.Initialise (Nini.Config.IConfigSource source)
177 { 181 {
178 //I have no overall config settings to care about. 182 //Determine if we have been enabled at all in OpenSim.ini -- this is part and parcel of being an optional module
183 IConfig moduleConfig = source.Configs["Modules"];
184 if (moduleConfig != null)
185 {
186 m_Enabled = moduleConfig.GetBoolean("AutoBackupModule", false);
187 if (m_Enabled)
188 {
189 m_log.Info("[AUTO BACKUP MODULE]: AutoBackupModule enabled");
190 }
191
192 }
179 } 193 }
180 194
181 void IRegionModuleBase.Close () 195 void IRegionModuleBase.Close ()
182 { 196 {
197 if(!m_Enabled)
198 return;
199
183 //We don't want any timers firing while the sim's coming down; strange things may happen. 200 //We don't want any timers firing while the sim's coming down; strange things may happen.
184 StopAllTimers(); 201 StopAllTimers();
185 } 202 }
@@ -191,6 +208,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
191 208
192 void IRegionModuleBase.RemoveRegion (Framework.Scenes.Scene scene) 209 void IRegionModuleBase.RemoveRegion (Framework.Scenes.Scene scene)
193 { 210 {
211 if(!m_Enabled)
212 return;
213
194 AutoBackupModuleState abms = states[scene]; 214 AutoBackupModuleState abms = states[scene];
195 Timer timer = abms.GetTimer(); 215 Timer timer = abms.GetTimer();
196 List<IScene> list = timerMap[timer]; 216 List<IScene> list = timerMap[timer];
@@ -205,6 +225,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
205 225
206 void IRegionModuleBase.RegionLoaded (Framework.Scenes.Scene scene) 226 void IRegionModuleBase.RegionLoaded (Framework.Scenes.Scene scene)
207 { 227 {
228 if(!m_Enabled)
229 return;
230
208 //This really ought not to happen, but just in case, let's pretend it didn't... 231 //This really ought not to happen, but just in case, let's pretend it didn't...
209 if(scene == null) 232 if(scene == null)
210 return; 233 return;