From 89c164fbc18e082bf2d036bd2167b824e90aebc1 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Wed, 28 May 2008 17:59:46 +0000
Subject: let Grid Servers specify a connect string in their configuration.
---
OpenSim/Data/MySQL/MySQLGridData.cs | 29 +++++++++++++++++------------
OpenSim/Data/MySQL/MySQLLogData.cs | 34 ++++++++++++++++++++++------------
2 files changed, 39 insertions(+), 24 deletions(-)
(limited to 'OpenSim/Data/MySQL')
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs
index e830133..421c283 100644
--- a/OpenSim/Data/MySQL/MySQLGridData.cs
+++ b/OpenSim/Data/MySQL/MySQLGridData.cs
@@ -51,19 +51,24 @@ namespace OpenSim.Data.MySQL
///
/// Initialises the Grid Interface
///
- override public void Initialise()
+ override public void Initialise(string connect)
{
- IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
- string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
- string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
- string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
- string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
- string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
- string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
-
- database =
- new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
- settingPort);
+ if (connect != String.Empty) {
+ database = new MySQLManager(connect);
+ } else {
+ m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
+ IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
+ string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
+ string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
+ string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
+ string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
+ string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
+ string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
+
+ database =
+ new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
+ settingPort);
+ }
TestTables();
}
diff --git a/OpenSim/Data/MySQL/MySQLLogData.cs b/OpenSim/Data/MySQL/MySQLLogData.cs
index bb34d34..0873066 100644
--- a/OpenSim/Data/MySQL/MySQLLogData.cs
+++ b/OpenSim/Data/MySQL/MySQLLogData.cs
@@ -24,6 +24,9 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using System;
+using System.Reflection;
+using log4net;
namespace OpenSim.Data.MySQL
{
@@ -31,7 +34,8 @@ namespace OpenSim.Data.MySQL
/// An interface to the log database for MySQL
///
internal class MySQLLogData : ILogData
- {
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
///
/// The database manager
///
@@ -40,19 +44,25 @@ namespace OpenSim.Data.MySQL
///
/// Artificial constructor called when the plugin is loaded
///
- public void Initialise()
+ public void Initialise(string connect)
{
- IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
- string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
- string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
- string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
- string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
- string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
- string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
+ if (connect != String.Empty) {
+ database = new MySQLManager(connect);
+ } else {
+ m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
- database =
- new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
- settingPort);
+ IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
+ string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
+ string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
+ string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
+ string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
+ string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
+ string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
+
+ database =
+ new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
+ settingPort);
+ }
}
///
--
cgit v1.1