diff options
author | Sean McNamara | 2011-02-19 23:07:54 -0500 |
---|---|---|
committer | Sean McNamara | 2011-02-19 23:07:54 -0500 |
commit | 7eac0af5590a450752a9fd2c57abe7d1a6d84c4c (patch) | |
tree | 0cfbf195924c53d5ef30173dd13741623b1517e4 /OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | |
parent | More debug messages (diff) | |
download | opensim-SC-7eac0af5590a450752a9fd2c57abe7d1a6d84c4c.zip opensim-SC-7eac0af5590a450752a9fd2c57abe7d1a6d84c4c.tar.gz opensim-SC-7eac0af5590a450752a9fd2c57abe7d1a6d84c4c.tar.bz2 opensim-SC-7eac0af5590a450752a9fd2c57abe7d1a6d84c4c.tar.xz |
Fix an actual bug in the timer interval calculation (minutes -> msec)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs index 21e48df..4899718 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | |||
@@ -240,7 +240,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
240 | states.Add(scene, st); | 240 | states.Add(scene, st); |
241 | 241 | ||
242 | //Read the config settings and set variables. | 242 | //Read the config settings and set variables. |
243 | IConfig config = m_configSource.Configs[scene.RegionInfo.RegionName]; | 243 | IConfig config = scene.Config.Configs["Startup"]; |
244 | if(config == null) | 244 | if(config == null) |
245 | { | 245 | { |
246 | m_log.Warn("[AUTO BACKUP MODULE]: Can't get config settings! Here are the IConfigs available:"); | 246 | m_log.Warn("[AUTO BACKUP MODULE]: Can't get config settings! Here are the IConfigs available:"); |
@@ -258,11 +258,17 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
258 | m_log.Warn("[AUTO BACKUP MODULE]: " + d.Name); | 258 | m_log.Warn("[AUTO BACKUP MODULE]: " + d.Name); |
259 | } | 259 | } |
260 | } | 260 | } |
261 | throw new NullReferenceException("This is debug code"); | 261 | throw new NullReferenceException("This is debug code"); //This crashes the whole process -- not good |
262 | } | 262 | } |
263 | st.SetEnabled(config.GetBoolean("AutoBackup", false)); | 263 | st.SetEnabled(config.GetBoolean("AutoBackup", false)); |
264 | if(!st.GetEnabled()) //If you don't want AutoBackup, we stop. | 264 | if(!st.GetEnabled()) //If you don't want AutoBackup, we stop. |
265 | { | ||
265 | return; | 266 | return; |
267 | } | ||
268 | else | ||
269 | { | ||
270 | m_log.Info("[AUTO BACKUP MODULE]: Region " + scene.RegionInfo.RegionName + " is AutoBackup ENABLED."); | ||
271 | } | ||
266 | 272 | ||
267 | //Borrow an existing timer if one exists for the same interval; otherwise, make a new one. | 273 | //Borrow an existing timer if one exists for the same interval; otherwise, make a new one. |
268 | double interval = config.GetDouble("AutoBackupInterval", 720); | 274 | double interval = config.GetDouble("AutoBackupInterval", 720); |
@@ -272,7 +278,13 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
272 | } | 278 | } |
273 | else | 279 | else |
274 | { | 280 | { |
275 | st.SetTimer(new Timer(interval)); | 281 | //0 or negative interval == do nothing. |
282 | if(interval <= 0.0) | ||
283 | { | ||
284 | st.SetEnabled(false); | ||
285 | return; | ||
286 | } | ||
287 | st.SetTimer(new Timer(interval * 60000)); //Milliseconds -> minutes | ||
276 | timers.Add(interval, st.GetTimer()); | 288 | timers.Add(interval, st.GetTimer()); |
277 | st.GetTimer().Elapsed += HandleElapsed; | 289 | st.GetTimer().Elapsed += HandleElapsed; |
278 | } | 290 | } |