diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs index 4735620..0869b0c 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | |||
@@ -40,10 +40,13 @@ 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: | 43 | * At the TOP LEVEL, e.g. in OpenSim.ini, we have the following options: |
44 | * In the [Modules] section: | 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! | 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! |
46 | * EACH REGION in e.g. Regions/Regions.ini can have the following options: | 46 | * EACH REGION, in OpenSim.ini, can have the following settings under the [AutoBackupModule] section. |
47 | * VERY IMPORTANT: You must create the key name as follows: <Region Name>.<Key Name> | ||
48 | * Example: My region is named Foo. | ||
49 | * If I wanted to specify the "AutoBackupInterval" key below, I would name my key "Foo.AutoBackupInterval", under the [AutoBackupModule] section of OpenSim.ini. | ||
47 | * AutoBackup: True/False. Default: False. If True, activate auto backup functionality. | 50 | * AutoBackup: True/False. Default: False. If True, activate auto backup functionality. |
48 | * This is the only required option for enabling auto-backup; the other options have sane defaults. | 51 | * This is the only required option for enabling auto-backup; the other options have sane defaults. |
49 | * If False, the auto-backup module becomes a no-op for the region, and all other AutoBackup* settings are ignored. | 52 | * If False, the auto-backup module becomes a no-op for the region, and all other AutoBackup* settings are ignored. |
@@ -190,7 +193,6 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
190 | { | 193 | { |
191 | m_log.Info("[AUTO BACKUP MODULE]: AutoBackupModule enabled"); | 194 | m_log.Info("[AUTO BACKUP MODULE]: AutoBackupModule enabled"); |
192 | } | 195 | } |
193 | |||
194 | } | 196 | } |
195 | } | 197 | } |
196 | 198 | ||
@@ -234,19 +236,20 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
234 | if(scene == null) | 236 | if(scene == null) |
235 | return; | 237 | return; |
236 | 238 | ||
239 | string sRegionName = scene.RegionInfo.RegionName; | ||
237 | AutoBackupModuleState st = new AutoBackupModuleState(scene); | 240 | AutoBackupModuleState st = new AutoBackupModuleState(scene); |
238 | states.Add(scene, st); | 241 | states.Add(scene, st); |
239 | 242 | ||
240 | //Read the config settings and set variables. | 243 | //Read the config settings and set variables. |
241 | IConfig config = scene.Config.Configs["AutoBackupModule"]; | 244 | IConfig config = m_configSource.Configs["AutoBackupModule"]; |
242 | if(config == null) | 245 | if(config == null) |
243 | { | 246 | { |
244 | //No config settings for this, let's just give up. | 247 | //No config settings for any regions, let's just give up. |
245 | st.SetEnabled(false); | 248 | st.SetEnabled(false); |
246 | m_log.Info("[AUTO BACKUP MODULE]: Region " + scene.RegionInfo.RegionName + " is NOT AutoBackup enabled."); | 249 | m_log.Info("[AUTO BACKUP MODULE]: Region " + scene.RegionInfo.RegionName + " is NOT AutoBackup enabled."); |
247 | return; | 250 | return; |
248 | } | 251 | } |
249 | st.SetEnabled(config.GetBoolean("AutoBackup", false)); | 252 | st.SetEnabled(config.GetBoolean(sRegionName + ".AutoBackup", false)); |
250 | if(!st.GetEnabled()) //If you don't want AutoBackup, we stop. | 253 | if(!st.GetEnabled()) //If you don't want AutoBackup, we stop. |
251 | { | 254 | { |
252 | m_log.Info("[AUTO BACKUP MODULE]: Region " + scene.RegionInfo.RegionName + " is NOT AutoBackup enabled."); | 255 | m_log.Info("[AUTO BACKUP MODULE]: Region " + scene.RegionInfo.RegionName + " is NOT AutoBackup enabled."); |
@@ -258,7 +261,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
258 | } | 261 | } |
259 | 262 | ||
260 | //Borrow an existing timer if one exists for the same interval; otherwise, make a new one. | 263 | //Borrow an existing timer if one exists for the same interval; otherwise, make a new one. |
261 | double interval = config.GetDouble("AutoBackupInterval", 720); | 264 | double interval = config.GetDouble(sRegionName + ".AutoBackupInterval", 720); |
262 | if(timers.ContainsKey(interval)) | 265 | if(timers.ContainsKey(interval)) |
263 | { | 266 | { |
264 | st.SetTimer(timers[interval]); | 267 | st.SetTimer(timers[interval]); |
@@ -287,10 +290,10 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
287 | timerMap.Add(st.GetTimer(), scns); | 290 | timerMap.Add(st.GetTimer(), scns); |
288 | } | 291 | } |
289 | 292 | ||
290 | st.SetBusyCheck(config.GetBoolean("AutoBackupBusyCheck", true)); | 293 | st.SetBusyCheck(config.GetBoolean(sRegionName + ".AutoBackupBusyCheck", true)); |
291 | 294 | ||
292 | //Set file naming algorithm | 295 | //Set file naming algorithm |
293 | string namingtype = config.GetString("AutoBackupNaming", "Time"); | 296 | string namingtype = config.GetString(sRegionName + ".AutoBackupNaming", "Time"); |
294 | if(namingtype.Equals("Time", StringComparison.CurrentCultureIgnoreCase)) | 297 | if(namingtype.Equals("Time", StringComparison.CurrentCultureIgnoreCase)) |
295 | { | 298 | { |
296 | st.SetNamingType(NamingType.TIME); | 299 | st.SetNamingType(NamingType.TIME); |
@@ -309,8 +312,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
309 | st.SetNamingType(NamingType.TIME); | 312 | st.SetNamingType(NamingType.TIME); |
310 | } | 313 | } |
311 | 314 | ||
312 | st.SetScript(config.GetString("AutoBackupScript", null)); | 315 | st.SetScript(config.GetString(sRegionName + ".AutoBackupScript", null)); |
313 | st.SetBackupDir(config.GetString("AutoBackupDir", ".")); | 316 | st.SetBackupDir(config.GetString(sRegionName + ".AutoBackupDir", ".")); |
314 | 317 | ||
315 | //Let's give the user *one* convenience and auto-mkdir | 318 | //Let's give the user *one* convenience and auto-mkdir |
316 | if(st.GetBackupDir() != ".") | 319 | if(st.GetBackupDir() != ".") |