diff options
author | Melanie | 2010-04-28 19:38:29 +0100 |
---|---|---|
committer | Melanie | 2010-04-28 19:38:29 +0100 |
commit | aba5db9ed4e941f464d19a20074cab1d0bc726d0 (patch) | |
tree | 45adf5185df75b3b361ab1961ef6e03d67e9b7cc | |
parent | Commented verbose debug messages from XInventory handler. (diff) | |
parent | Refactoring in Migration.cs: "using()" instead of explicit Dispose() (diff) | |
download | opensim-SC_OLD-aba5db9ed4e941f464d19a20074cab1d0bc726d0.zip opensim-SC_OLD-aba5db9ed4e941f464d19a20074cab1d0bc726d0.tar.gz opensim-SC_OLD-aba5db9ed4e941f464d19a20074cab1d0bc726d0.tar.bz2 opensim-SC_OLD-aba5db9ed4e941f464d19a20074cab1d0bc726d0.tar.xz |
Merge branch 'minor-stuff'
-rw-r--r-- | .gitignore | 9 | ||||
-rw-r--r-- | OpenSim/Data/Migration.cs | 112 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 11 | ||||
-rw-r--r-- | OpenSim/Services/InventoryService/InventoryService.cs | 2 |
8 files changed, 83 insertions, 67 deletions
@@ -9,6 +9,14 @@ | |||
9 | *.pdb | 9 | *.pdb |
10 | *.pidb | 10 | *.pidb |
11 | *.dll.build | 11 | *.dll.build |
12 | *.dll | ||
13 | *.VisualState.xml | ||
14 | */*/obj | ||
15 | */*/*/obj | ||
16 | */*/*/*/obj | ||
17 | */*/*/*/*/obj | ||
18 | */*/*/*/*/*/obj | ||
19 | */*/*/*/*/*/*/obj | ||
12 | */*/bin | 20 | */*/bin |
13 | */*/*/bin | 21 | */*/*/bin |
14 | */*/*/*/bin | 22 | */*/*/*/bin |
@@ -45,6 +53,7 @@ bin/OpenSim.Grid.InventoryServer.log | |||
45 | bin/OpenSim.Grid.MessagingServer.log | 53 | bin/OpenSim.Grid.MessagingServer.log |
46 | bin/OpenSim.Grid.UserServer.log | 54 | bin/OpenSim.Grid.UserServer.log |
47 | bin/OpenSim.log | 55 | bin/OpenSim.log |
56 | bin/*.manifest | ||
48 | bin/crashes/ | 57 | bin/crashes/ |
49 | Examples/*.dll | 58 | Examples/*.dll |
50 | OpenSim.build | 59 | OpenSim.build |
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 0fb9e78..06defe4 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -53,8 +53,8 @@ namespace OpenSim.Data | |||
53 | /// When a database driver starts up, it specifies a resource that | 53 | /// When a database driver starts up, it specifies a resource that |
54 | /// needs to be brought up to the current revision. For instance: | 54 | /// needs to be brought up to the current revision. For instance: |
55 | /// | 55 | /// |
56 | /// Migration um = new Migration(Assembly, DbConnection, "Users"); | 56 | /// Migration um = new Migration(DbConnection, Assembly, "Users"); |
57 | /// um.Upgrade(); | 57 | /// um.Update(); |
58 | /// | 58 | /// |
59 | /// This works out which version Users is at, and applies all the | 59 | /// This works out which version Users is at, and applies all the |
60 | /// revisions past it to it. If there is no users table, all | 60 | /// revisions past it to it. If there is no users table, all |
@@ -110,10 +110,11 @@ namespace OpenSim.Data | |||
110 | return; | 110 | return; |
111 | 111 | ||
112 | // If not, create the migration tables | 112 | // If not, create the migration tables |
113 | DbCommand cmd = _conn.CreateCommand(); | 113 | using (DbCommand cmd = _conn.CreateCommand()) |
114 | cmd.CommandText = _migrations_create; | 114 | { |
115 | cmd.ExecuteNonQuery(); | 115 | cmd.CommandText = _migrations_create; |
116 | cmd.Dispose(); | 116 | cmd.ExecuteNonQuery(); |
117 | } | ||
117 | 118 | ||
118 | InsertVersion("migrations", 1); | 119 | InsertVersion("migrations", 1); |
119 | } | 120 | } |
@@ -131,37 +132,37 @@ namespace OpenSim.Data | |||
131 | m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); | 132 | m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); |
132 | m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); | 133 | m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); |
133 | 134 | ||
134 | DbCommand cmd = _conn.CreateCommand(); | 135 | using (DbCommand cmd = _conn.CreateCommand()) |
135 | foreach (KeyValuePair<int, string> kvp in migrations) | ||
136 | { | 136 | { |
137 | int newversion = kvp.Key; | 137 | foreach (KeyValuePair<int, string> kvp in migrations) |
138 | cmd.CommandText = kvp.Value; | ||
139 | // we need to up the command timeout to infinite as we might be doing long migrations. | ||
140 | cmd.CommandTimeout = 0; | ||
141 | try | ||
142 | { | ||
143 | cmd.ExecuteNonQuery(); | ||
144 | } | ||
145 | catch (Exception e) | ||
146 | { | 138 | { |
147 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); | 139 | int newversion = kvp.Key; |
148 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); | 140 | cmd.CommandText = kvp.Value; |
149 | cmd.CommandText = "ROLLBACK;"; | 141 | // we need to up the command timeout to infinite as we might be doing long migrations. |
150 | cmd.ExecuteNonQuery(); | 142 | cmd.CommandTimeout = 0; |
151 | } | 143 | try |
144 | { | ||
145 | cmd.ExecuteNonQuery(); | ||
146 | } | ||
147 | catch (Exception e) | ||
148 | { | ||
149 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); | ||
150 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); | ||
151 | cmd.CommandText = "ROLLBACK;"; | ||
152 | cmd.ExecuteNonQuery(); | ||
153 | } | ||
152 | 154 | ||
153 | if (version == 0) | 155 | if (version == 0) |
154 | { | 156 | { |
155 | InsertVersion(_type, newversion); | 157 | InsertVersion(_type, newversion); |
156 | } | 158 | } |
157 | else | 159 | else |
158 | { | 160 | { |
159 | UpdateVersion(_type, newversion); | 161 | UpdateVersion(_type, newversion); |
162 | } | ||
163 | version = newversion; | ||
160 | } | 164 | } |
161 | version = newversion; | ||
162 | } | 165 | } |
163 | |||
164 | cmd.Dispose(); | ||
165 | } | 166 | } |
166 | 167 | ||
167 | // private int MaxVersion() | 168 | // private int MaxVersion() |
@@ -200,43 +201,46 @@ namespace OpenSim.Data | |||
200 | protected virtual int FindVersion(DbConnection conn, string type) | 201 | protected virtual int FindVersion(DbConnection conn, string type) |
201 | { | 202 | { |
202 | int version = 0; | 203 | int version = 0; |
203 | DbCommand cmd = conn.CreateCommand(); | 204 | using (DbCommand cmd = conn.CreateCommand()) |
204 | try | ||
205 | { | 205 | { |
206 | cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc"; | 206 | try |
207 | using (IDataReader reader = cmd.ExecuteReader()) | ||
208 | { | 207 | { |
209 | if (reader.Read()) | 208 | cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc"; |
209 | using (IDataReader reader = cmd.ExecuteReader()) | ||
210 | { | 210 | { |
211 | version = Convert.ToInt32(reader["version"]); | 211 | if (reader.Read()) |
212 | { | ||
213 | version = Convert.ToInt32(reader["version"]); | ||
214 | } | ||
215 | reader.Close(); | ||
212 | } | 216 | } |
213 | reader.Close(); | 217 | } |
218 | catch | ||
219 | { | ||
220 | // Something went wrong, so we're version 0 | ||
214 | } | 221 | } |
215 | } | 222 | } |
216 | catch | ||
217 | { | ||
218 | // Something went wrong, so we're version 0 | ||
219 | } | ||
220 | cmd.Dispose(); | ||
221 | return version; | 223 | return version; |
222 | } | 224 | } |
223 | 225 | ||
224 | private void InsertVersion(string type, int version) | 226 | private void InsertVersion(string type, int version) |
225 | { | 227 | { |
226 | DbCommand cmd = _conn.CreateCommand(); | 228 | using (DbCommand cmd = _conn.CreateCommand()) |
227 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; | 229 | { |
228 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); | 230 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; |
229 | cmd.ExecuteNonQuery(); | 231 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); |
230 | cmd.Dispose(); | 232 | cmd.ExecuteNonQuery(); |
233 | } | ||
231 | } | 234 | } |
232 | 235 | ||
233 | private void UpdateVersion(string type, int version) | 236 | private void UpdateVersion(string type, int version) |
234 | { | 237 | { |
235 | DbCommand cmd = _conn.CreateCommand(); | 238 | using (DbCommand cmd = _conn.CreateCommand()) |
236 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; | 239 | { |
237 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); | 240 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; |
238 | cmd.ExecuteNonQuery(); | 241 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); |
239 | cmd.Dispose(); | 242 | cmd.ExecuteNonQuery(); |
243 | } | ||
240 | } | 244 | } |
241 | 245 | ||
242 | // private SortedList<int, string> GetAllMigrations() | 246 | // private SortedList<int, string> GetAllMigrations() |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 192deb2..e0e9b9c 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -145,7 +145,7 @@ namespace OpenSim.Data.MySQL | |||
145 | /// <summary> | 145 | /// <summary> |
146 | /// Returns a list of the root folders within a users inventory | 146 | /// Returns a list of the root folders within a users inventory |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <param name="user">The user whos inventory is to be searched</param> | 148 | /// <param name="user">The user whose inventory is to be searched</param> |
149 | /// <returns>A list of folder objects</returns> | 149 | /// <returns>A list of folder objects</returns> |
150 | public List<InventoryFolderBase> getUserRootFolders(UUID user) | 150 | public List<InventoryFolderBase> getUserRootFolders(UUID user) |
151 | { | 151 | { |
@@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL | |||
284 | { | 284 | { |
285 | InventoryItemBase item = new InventoryItemBase(); | 285 | InventoryItemBase item = new InventoryItemBase(); |
286 | 286 | ||
287 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is indemic to the system, or legacy. It would be nice to live fix these. | 287 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. |
288 | if (reader["creatorID"] == null) | 288 | if (reader["creatorID"] == null) |
289 | { | 289 | { |
290 | item.CreatorId = UUID.Zero.ToString(); | 290 | item.CreatorId = UUID.Zero.ToString(); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 312db38..23d5b3c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
149 | 149 | ||
150 | if (m_FriendsService == null) | 150 | if (m_FriendsService == null) |
151 | { | 151 | { |
152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue"); | 152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or failed to load, cannot continue"); |
153 | throw new Exception("Connector load error"); | 153 | throw new Exception("Connector load error"); |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs index 5fac189..16cd7e4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs | |||
@@ -39,6 +39,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | { | 39 | { |
40 | int Type { get; } | 40 | int Type { get; } |
41 | UUID AssetID { get; } | 41 | UUID AssetID { get; } |
42 | T RetreiveAsset<T>() where T : Asset, new(); | 42 | T RetrieveAsset<T>() where T : Asset, new(); |
43 | } | 43 | } |
44 | } | 44 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs index 5bf29d7..bf85cbc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs | |||
@@ -39,11 +39,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | public class InventoryItem : IInventoryItem | 39 | public class InventoryItem : IInventoryItem |
40 | { | 40 | { |
41 | TaskInventoryItem m_privateItem; | 41 | TaskInventoryItem m_privateItem; |
42 | Scene m_rootSceene; | 42 | Scene m_rootScene; |
43 | 43 | ||
44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) | 44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) |
45 | { | 45 | { |
46 | m_rootSceene = rootScene; | 46 | m_rootScene = rootScene; |
47 | m_privateItem = internalItem; | 47 | m_privateItem = internalItem; |
48 | } | 48 | } |
49 | 49 | ||
@@ -82,9 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
82 | public UUID AssetID { get { return m_privateItem.AssetID; } } | 82 | public UUID AssetID { get { return m_privateItem.AssetID; } } |
83 | 83 | ||
84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. | 84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. |
85 | public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() | 85 | public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() |
86 | { | 86 | { |
87 | AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); | 87 | AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString()); |
88 | T result = new T(); | 88 | T result = new T(); |
89 | 89 | ||
90 | if ((sbyte)result.AssetType != a.Type) | 90 | if ((sbyte)result.AssetType != a.Type) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index d8c0ba5..f719683 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -261,13 +261,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
261 | // } | 261 | // } |
262 | //} | 262 | //} |
263 | 263 | ||
264 | public object GetCompilerOutput(UUID assetID) | 264 | public string GetCompilerOutput(string assetID) |
265 | { | 265 | { |
266 | return Path.Combine(ScriptEnginesPath, Path.Combine( | 266 | return Path.Combine(ScriptEnginesPath, Path.Combine( |
267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | 267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), |
268 | FilePrefix + "_compiled_" + assetID + ".dll")); | 268 | FilePrefix + "_compiled_" + assetID + ".dll")); |
269 | } | 269 | } |
270 | 270 | ||
271 | public string GetCompilerOutput(UUID assetID) | ||
272 | { | ||
273 | return GetCompilerOutput(assetID.ToString()); | ||
274 | } | ||
275 | |||
271 | /// <summary> | 276 | /// <summary> |
272 | /// Converts script from LSL to CS and calls CompileFromCSText | 277 | /// Converts script from LSL to CS and calls CompileFromCSText |
273 | /// </summary> | 278 | /// </summary> |
@@ -279,9 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
279 | linemap = null; | 284 | linemap = null; |
280 | m_warnings.Clear(); | 285 | m_warnings.Clear(); |
281 | 286 | ||
282 | assembly = Path.Combine(ScriptEnginesPath, Path.Combine( | 287 | assembly = GetCompilerOutput(asset); |
283 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | ||
284 | FilePrefix + "_compiled_" + asset + ".dll")); | ||
285 | 288 | ||
286 | if (!Directory.Exists(ScriptEnginesPath)) | 289 | if (!Directory.Exists(ScriptEnginesPath)) |
287 | { | 290 | { |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 0d6577e..fbcd663 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -109,7 +109,7 @@ namespace OpenSim.Services.InventoryService | |||
109 | { | 109 | { |
110 | existingRootFolder = GetRootFolder(user); | 110 | existingRootFolder = GetRootFolder(user); |
111 | } | 111 | } |
112 | catch (Exception e) | 112 | catch /*(Exception e)*/ |
113 | { | 113 | { |
114 | // Munch the exception, it has already been reported | 114 | // Munch the exception, it has already been reported |
115 | // | 115 | // |