Merge branch 'minor-stuff'

slimupdates
Melanie 2010-04-28 19:38:29 +01:00
commit aba5db9ed4
8 changed files with 83 additions and 67 deletions

9
.gitignore vendored
View File

@ -9,6 +9,14 @@
*.pdb *.pdb
*.pidb *.pidb
*.dll.build *.dll.build
*.dll
*.VisualState.xml
*/*/obj
*/*/*/obj
*/*/*/*/obj
*/*/*/*/*/obj
*/*/*/*/*/*/obj
*/*/*/*/*/*/*/obj
*/*/bin */*/bin
*/*/*/bin */*/*/bin
*/*/*/*/bin */*/*/*/bin
@ -45,6 +53,7 @@ bin/OpenSim.Grid.InventoryServer.log
bin/OpenSim.Grid.MessagingServer.log bin/OpenSim.Grid.MessagingServer.log
bin/OpenSim.Grid.UserServer.log bin/OpenSim.Grid.UserServer.log
bin/OpenSim.log bin/OpenSim.log
bin/*.manifest
bin/crashes/ bin/crashes/
Examples/*.dll Examples/*.dll
OpenSim.build OpenSim.build

View File

@ -53,8 +53,8 @@ namespace OpenSim.Data
/// When a database driver starts up, it specifies a resource that /// When a database driver starts up, it specifies a resource that
/// needs to be brought up to the current revision. For instance: /// needs to be brought up to the current revision. For instance:
/// ///
/// Migration um = new Migration(Assembly, DbConnection, "Users"); /// Migration um = new Migration(DbConnection, Assembly, "Users");
/// um.Upgrade(); /// um.Update();
/// ///
/// This works out which version Users is at, and applies all the /// This works out which version Users is at, and applies all the
/// revisions past it to it. If there is no users table, all /// revisions past it to it. If there is no users table, all
@ -110,10 +110,11 @@ namespace OpenSim.Data
return; return;
// If not, create the migration tables // If not, create the migration tables
DbCommand cmd = _conn.CreateCommand(); using (DbCommand cmd = _conn.CreateCommand())
cmd.CommandText = _migrations_create; {
cmd.ExecuteNonQuery(); cmd.CommandText = _migrations_create;
cmd.Dispose(); cmd.ExecuteNonQuery();
}
InsertVersion("migrations", 1); InsertVersion("migrations", 1);
} }
@ -131,37 +132,37 @@ namespace OpenSim.Data
m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]);
m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!");
DbCommand cmd = _conn.CreateCommand(); using (DbCommand cmd = _conn.CreateCommand())
foreach (KeyValuePair<int, string> kvp in migrations)
{ {
int newversion = kvp.Key; foreach (KeyValuePair<int, string> kvp in migrations)
cmd.CommandText = kvp.Value;
// we need to up the command timeout to infinite as we might be doing long migrations.
cmd.CommandTimeout = 0;
try
{ {
cmd.ExecuteNonQuery(); int newversion = kvp.Key;
} cmd.CommandText = kvp.Value;
catch (Exception e) // we need to up the command timeout to infinite as we might be doing long migrations.
{ cmd.CommandTimeout = 0;
m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); try
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); {
cmd.CommandText = "ROLLBACK;"; cmd.ExecuteNonQuery();
cmd.ExecuteNonQuery(); }
} catch (Exception e)
{
m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText);
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);
cmd.CommandText = "ROLLBACK;";
cmd.ExecuteNonQuery();
}
if (version == 0) if (version == 0)
{ {
InsertVersion(_type, newversion); InsertVersion(_type, newversion);
}
else
{
UpdateVersion(_type, newversion);
}
version = newversion;
} }
else
{
UpdateVersion(_type, newversion);
}
version = newversion;
} }
cmd.Dispose();
} }
// private int MaxVersion() // private int MaxVersion()
@ -200,43 +201,46 @@ namespace OpenSim.Data
protected virtual int FindVersion(DbConnection conn, string type) protected virtual int FindVersion(DbConnection conn, string type)
{ {
int version = 0; int version = 0;
DbCommand cmd = conn.CreateCommand(); using (DbCommand cmd = conn.CreateCommand())
try
{ {
cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc"; try
using (IDataReader reader = cmd.ExecuteReader())
{ {
if (reader.Read()) cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc";
using (IDataReader reader = cmd.ExecuteReader())
{ {
version = Convert.ToInt32(reader["version"]); if (reader.Read())
{
version = Convert.ToInt32(reader["version"]);
}
reader.Close();
} }
reader.Close(); }
catch
{
// Something went wrong, so we're version 0
} }
} }
catch
{
// Something went wrong, so we're version 0
}
cmd.Dispose();
return version; return version;
} }
private void InsertVersion(string type, int version) private void InsertVersion(string type, int version)
{ {
DbCommand cmd = _conn.CreateCommand(); using (DbCommand cmd = _conn.CreateCommand())
cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; {
m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
cmd.ExecuteNonQuery(); m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version);
cmd.Dispose(); cmd.ExecuteNonQuery();
}
} }
private void UpdateVersion(string type, int version) private void UpdateVersion(string type, int version)
{ {
DbCommand cmd = _conn.CreateCommand(); using (DbCommand cmd = _conn.CreateCommand())
cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; {
m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
cmd.ExecuteNonQuery(); m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version);
cmd.Dispose(); cmd.ExecuteNonQuery();
}
} }
// private SortedList<int, string> GetAllMigrations() // private SortedList<int, string> GetAllMigrations()

View File

@ -145,7 +145,7 @@ namespace OpenSim.Data.MySQL
/// <summary> /// <summary>
/// Returns a list of the root folders within a users inventory /// Returns a list of the root folders within a users inventory
/// </summary> /// </summary>
/// <param name="user">The user whos inventory is to be searched</param> /// <param name="user">The user whose inventory is to be searched</param>
/// <returns>A list of folder objects</returns> /// <returns>A list of folder objects</returns>
public List<InventoryFolderBase> getUserRootFolders(UUID user) public List<InventoryFolderBase> getUserRootFolders(UUID user)
{ {
@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
// 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. // 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.
if (reader["creatorID"] == null) if (reader["creatorID"] == null)
{ {
item.CreatorId = UUID.Zero.ToString(); item.CreatorId = UUID.Zero.ToString();

View File

@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (m_FriendsService == null) if (m_FriendsService == null)
{ {
m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue"); m_log.Error("[FRIENDS]: No Connector defined in section Friends, or failed to load, cannot continue");
throw new Exception("Connector load error"); throw new Exception("Connector load error");
} }

View File

@ -39,6 +39,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
int Type { get; } int Type { get; }
UUID AssetID { get; } UUID AssetID { get; }
T RetreiveAsset<T>() where T : Asset, new(); T RetrieveAsset<T>() where T : Asset, new();
} }
} }

View File

@ -39,11 +39,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public class InventoryItem : IInventoryItem public class InventoryItem : IInventoryItem
{ {
TaskInventoryItem m_privateItem; TaskInventoryItem m_privateItem;
Scene m_rootSceene; Scene m_rootScene;
public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) public InventoryItem(Scene rootScene, TaskInventoryItem internalItem)
{ {
m_rootSceene = rootScene; m_rootScene = rootScene;
m_privateItem = internalItem; m_privateItem = internalItem;
} }
@ -82,9 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public UUID AssetID { get { return m_privateItem.AssetID; } } public UUID AssetID { get { return m_privateItem.AssetID; } }
// This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM.
public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new()
{ {
AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString());
T result = new T(); T result = new T();
if ((sbyte)result.AssetType != a.Type) if ((sbyte)result.AssetType != a.Type)

View File

@ -261,13 +261,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
// } // }
//} //}
public object GetCompilerOutput(UUID assetID) public string GetCompilerOutput(string assetID)
{ {
return Path.Combine(ScriptEnginesPath, Path.Combine( return Path.Combine(ScriptEnginesPath, Path.Combine(
m_scriptEngine.World.RegionInfo.RegionID.ToString(), m_scriptEngine.World.RegionInfo.RegionID.ToString(),
FilePrefix + "_compiled_" + assetID + ".dll")); FilePrefix + "_compiled_" + assetID + ".dll"));
} }
public string GetCompilerOutput(UUID assetID)
{
return GetCompilerOutput(assetID.ToString());
}
/// <summary> /// <summary>
/// Converts script from LSL to CS and calls CompileFromCSText /// Converts script from LSL to CS and calls CompileFromCSText
/// </summary> /// </summary>
@ -279,9 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
linemap = null; linemap = null;
m_warnings.Clear(); m_warnings.Clear();
assembly = Path.Combine(ScriptEnginesPath, Path.Combine( assembly = GetCompilerOutput(asset);
m_scriptEngine.World.RegionInfo.RegionID.ToString(),
FilePrefix + "_compiled_" + asset + ".dll"));
if (!Directory.Exists(ScriptEnginesPath)) if (!Directory.Exists(ScriptEnginesPath))
{ {

View File

@ -109,7 +109,7 @@ namespace OpenSim.Services.InventoryService
{ {
existingRootFolder = GetRootFolder(user); existingRootFolder = GetRootFolder(user);
} }
catch (Exception e) catch /*(Exception e)*/
{ {
// Munch the exception, it has already been reported // Munch the exception, it has already been reported
// //