aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorAdam Frisby2008-04-20 05:44:54 +0000
committerAdam Frisby2008-04-20 05:44:54 +0000
commit93efd6ff39f038a288aa21b6c7b03fea991e19be (patch)
tree33a64b73a7a21591de319c4d16001deedda63ec1 /OpenSim/Region
parent* Added support for new "svn load-region <region name> [svn revision]" comman... (diff)
downloadopensim-SC-93efd6ff39f038a288aa21b6c7b03fea991e19be.zip
opensim-SC-93efd6ff39f038a288aa21b6c7b03fea991e19be.tar.gz
opensim-SC-93efd6ff39f038a288aa21b6c7b03fea991e19be.tar.bz2
opensim-SC-93efd6ff39f038a288aa21b6c7b03fea991e19be.tar.xz
* Added some more fixes, refactored SVNModule slightly.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs43
1 files changed, 31 insertions, 12 deletions
diff --git a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
index 022755b..f6a98ac 100644
--- a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
+++ b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
@@ -30,6 +30,29 @@ namespace OpenSim.Region.Modules.SvnSerialiser
30 30
31 public void SaveRegion(Scene scene) 31 public void SaveRegion(Scene scene)
32 { 32 {
33 List<string> svnfilenames = CreateAndAddExport(scene);
34
35 m_svnClient.Commit3(svnfilenames, true, false);
36 m_log.Info("[SVNBACKUP]: Region backup successful (" + scene.RegionInfo.RegionName + ").");
37 }
38
39 public void SaveAllRegions()
40 {
41 List<string> svnfilenames = new List<string>();
42 List<string> regions = new List<string>();
43
44 foreach (Scene scene in m_scenes)
45 {
46 svnfilenames.AddRange(CreateAndAddExport(scene));
47 regions.Add("'" + scene.RegionInfo.RegionName + "' ");
48 }
49
50 m_svnClient.Commit3(svnfilenames, true, false);
51 m_log.Info("[SVNBACKUP]: Server backup successful ( " + String.Concat(regions.ToArray()) + ").");
52 }
53
54 private List<string> CreateAndAddExport(Scene scene)
55 {
33 m_log.Info("[SVNBACKUP]: Saving a region to SVN with name " + scene.RegionInfo.RegionName); 56 m_log.Info("[SVNBACKUP]: Saving a region to SVN with name " + scene.RegionInfo.RegionName);
34 57
35 List<string> filenames = m_serialiser.SerialiseRegion(scene, m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + "\\"); 58 List<string> filenames = m_serialiser.SerialiseRegion(scene, m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + "\\");
@@ -45,8 +68,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
45 svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + Slash.DirectorySeparatorChar + filename); 68 svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + Slash.DirectorySeparatorChar + filename);
46 svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString()); 69 svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString());
47 70
48 m_svnClient.Commit3(svnfilenames, true, false); 71 return svnfilenames;
49 m_log.Info("[SVNBACKUP]: Region backup successful (" + scene.RegionInfo.RegionName + ").");
50 } 72 }
51 73
52 public void LoadRegion(Scene scene) 74 public void LoadRegion(Scene scene)
@@ -103,15 +125,16 @@ namespace OpenSim.Region.Modules.SvnSerialiser
103 if (!commitItems.IsNull) 125 if (!commitItems.IsNull)
104 { 126 {
105 foreach (SvnClientCommitItem2 item in commitItems) 127 foreach (SvnClientCommitItem2 item in commitItems)
106 { 128 {
107 m_log.Debug("[SVNBACKUP]: Updated " + item.Path.ToString() + " (" + item.Kind.ToString() + ") " + item.Revision.ToString()); 129 m_log.Debug("[SVNBACKUP]: ... " + System.IO.Path.GetFileName(item.Path.ToString()) + " (" + item.Kind.ToString() + ") r" + item.Revision.ToString());
108 m_log.Debug("[SVNBACKUP]: " + item.Url.ToString() + " -> " + item.CopyFromUrl.ToString());
109 } 130 }
110 } 131 }
111 132
112 m_log.Debug("[SVNBACKUP]: Appending log message."); 133 string msg = "Region Backup (" + System.Environment.MachineName + " at " + DateTime.UtcNow.ToString() + " UTC)";
134
135 m_log.Debug("[SVNBACKUP]: Saved with message: " + msg);
113 136
114 logMessage = new AprString("Automated Region Backup", pool); 137 logMessage = new AprString(msg, pool);
115 tmpFile = new SvnPath(pool); 138 tmpFile = new SvnPath(pool);
116 139
117 return (SvnError.NoError); 140 return (SvnError.NoError);
@@ -234,10 +257,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
234 257
235 private void SaveAllScenes() 258 private void SaveAllScenes()
236 { 259 {
237 foreach (Scene scene in m_scenes) 260 SaveAllRegions();
238 {
239 SaveRegion(scene);
240 }
241 } 261 }
242 262
243 public void PostInitialise() 263 public void PostInitialise()
@@ -265,7 +285,6 @@ namespace OpenSim.Region.Modules.SvnSerialiser
265 285
266 private void SetupSerialiser() 286 private void SetupSerialiser()
267 { 287 {
268
269 if (m_scenes.Count > 0) 288 if (m_scenes.Count > 0)
270 m_serialiser = m_scenes[0].RequestModuleInterface<IRegionSerialiser>(); 289 m_serialiser = m_scenes[0].RequestModuleInterface<IRegionSerialiser>();
271 } 290 }