aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Server/Handlers/Web/WebServerInConnector.cs48
-rw-r--r--example/web/loginpage.html10
-rw-r--r--prebuild.xml3
3 files changed, 48 insertions, 13 deletions
diff --git a/OpenSim/Server/Handlers/Web/WebServerInConnector.cs b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
index e7fb2fc..01c74fe 100644
--- a/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
@@ -38,6 +38,7 @@ using OpenMetaverse;
38using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39using Nini.Config; 39using Nini.Config;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Data.MySQL;
41using OpenSim.Framework.Servers.HttpServer; 42using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Server.Handlers.Base; 43using OpenSim.Server.Handlers.Base;
43 44
@@ -48,12 +49,39 @@ namespace OpenSim.Server.Handlers.Web
48 // This is all slow and clunky, it's not a real web server, just something to use if you don't want a real one. 49 // This is all slow and clunky, it's not a real web server, just something to use if you don't want a real one.
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private IConfigSource m_Config; 51 private IConfigSource m_Config;
52 protected MySQLGenericHandler m_Database = null;
51 private Hashtable mime = new Hashtable(); 53 private Hashtable mime = new Hashtable();
52 private Hashtable ssi = new Hashtable(); 54 private Hashtable ssi = new Hashtable();
53 55
54 public WebServerInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) 56 public WebServerInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName)
55 { 57 {
56 m_Config = config; 58 m_Config = config;
59
60 string dllName = String.Empty;
61 string connString = String.Empty;
62
63 //
64 // Try reading the [DatabaseService] section, if it exists
65 //
66 IConfig dbConfig = m_Config.Configs["DatabaseService"];
67 if (dbConfig != null)
68 {
69 if (dllName == String.Empty)
70 dllName = dbConfig.GetString("StorageProvider", String.Empty);
71 if (connString == String.Empty)
72 connString = dbConfig.GetString("ConnectionString", String.Empty);
73 }
74
75 if (dllName.Equals(String.Empty))
76 throw new Exception("No StorageProvider configured");
77
78//// TODO - Should do the plugin thing to pick between database backends.
79// m_Database = LoadPlugin<SQLGenericHandler>(dllName, new Object[] { connString });
80 m_Database = new MySQLGenericHandler(connString);
81 if (m_Database == null)
82 throw new Exception("Could not find a storage interface in the given module " + dllName);
83
84
57 mime.Add(".gz", "application/gzip"); 85 mime.Add(".gz", "application/gzip");
58 mime.Add(".js", "application/javascript"); 86 mime.Add(".js", "application/javascript");
59 mime.Add(".json", "application/json"); 87 mime.Add(".json", "application/json");
@@ -90,15 +118,19 @@ namespace OpenSim.Server.Handlers.Web
90 118
91 private Hashtable WebRequestHandler(Hashtable request) 119 private Hashtable WebRequestHandler(Hashtable request)
92 { 120 {
121 long locIn = m_Database.GetCount("Presence", "RegionID != '00000000-0000-0000-0000-000000000000'"); // Locals online but not HGing.
122// long HGin = m_Database.GetCount("hg_traveling_data", "GridExternalName = '" + ssi["uri"] + "'"); // HGers in world, and locals not HGing, sometimes more than once.
123 long locOut = m_Database.GetCount("hg_traveling_data", "GridExternalName != '" + ssi["uri"] + "'"); // Locals that are HGing.
93 Hashtable reply = new Hashtable(); 124 Hashtable reply = new Hashtable();
94 // Looks like we have to jump through hoops to do simple database queries. B-( 125 ssi["members"] = m_Database.GetCount("UserAccounts").ToString();
95 ssi["members"] = "?"; // SELECT COUNT(PrincipalID) FROM UserAccounts 126 ssi["sims"] = m_Database.GetCount("regions").ToString();
96 ssi["inworld"] = "?"; // SELECT COUNT(UserID) FROM presence_culled; Includes locals and HGers in world, but not locals HGing. 127 ssi["inworld"] = locIn.ToString();
97 // SELECT COUNT(UserID) FROM users_online; Includes local online only. 128 ssi["outworld"] = locOut.ToString();
98 ssi["outworld"] = "?"; // SELECT COUNT(UserID) FROM hg_traveling_data WHERE GridExternalName != ssi["uri"]; Includes locals that are HGing. 129// ssi["hgers"] = HGin.ToString();
99// ssi["hgers"] = "?"; // This is complex. 130 ssi["hgers"] = "?";
100 ssi["sims"] = "?"; // SELECT COUNT(uuid) FROM regions 131 ssi["month"] = m_Database.GetCount("GridUser", "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200))").ToString();
101// ssi["month"] = "?"; // SELECT COUNT(UserID) FROM Presence WHERE LastSeen < one month ago 2017-11-28 09:01:51; Includes external HGers, and locals on now. 132 // SELECT COUNT(UserID) FROM Presence WHERE LastSeen < one month ago 2017-11-28 09:01:51; This is not accurate, and never has been.
133 // SELECT COUNT(UserID) FROM {GridUser} WHERE Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200)
102 134
103 string reqpath = (string) request["uri"]; 135 string reqpath = (string) request["uri"];
104 string[] query = (string[]) request["querystringkeys"]; 136 string[] query = (string[]) request["querystringkeys"];
diff --git a/example/web/loginpage.html b/example/web/loginpage.html
index ebce4aa..614c73d 100644
--- a/example/web/loginpage.html
+++ b/example/web/loginpage.html
@@ -70,11 +70,11 @@ a:active {color: blue;}
70 <div class="top-right"> 70 <div class="top-right">
71 <h1>Login URI - <!--#echo var="uri" --></h1> 71 <h1>Login URI - <!--#echo var="uri" --></h1>
72 <p>&nbsp;</p> 72 <p>&nbsp;</p>
73 <p><!--#echo var="grid" --> may or maynot be in good shape now.</p> 73 <p>There are <!--#echo var="members" --> members of this grid.</p>
74 <p>There are likely some (<!--#echo var="members" -->) members of this grid.</p> 74 <p>There are <!--#echo var="inworld" --> locals and <!--#echo var="hgers" --> hypergrid visitors in world.</p>
75 <p>There are maybe some (<!--#echo var="inworld" -->) people in world now (including hypergridders).</p> 75 <p>There are <!--#echo var="outworld" --> locals out on the hypergrid.</p>
76 <p>There are maybe some (<!--#echo var="outworld" -->) locals hypergridding now.</p> 76 <p>There have been <!--#echo var="month" --> people on this grid in the last month.</p>
77 <p>There is probably at least one (<!--#echo var="sims" -->) region, maybe more.</p> 77 <p>There are <!--#echo var="sims" --> regions, though some might not be online right now.</p>
78 </div> 78 </div>
79 <div class="centre"> 79 <div class="centre">
80 <p>Maybe add some news or events here, or something.</p> 80 <p>Maybe add some news or events here, or something.</p>
diff --git a/prebuild.xml b/prebuild.xml
index 0241fb3..c4c5e4f 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1208,6 +1208,9 @@
1208 <Reference name="OpenMetaverseTypes" path="../../../bin/"/> 1208 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
1209 <Reference name="OpenMetaverse" path="../../../bin/"/> 1209 <Reference name="OpenMetaverse" path="../../../bin/"/>
1210 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> 1210 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
1211 <Reference name="OpenSim.Data"/>
1212 <Reference name="OpenSim.Data.MySQL"/>
1213 <Reference name="MySql.Data" path="../../../bin/"/>
1211 <Reference name="OpenSim.Framework"/> 1214 <Reference name="OpenSim.Framework"/>
1212 <Reference name="OpenSim.Framework.Console"/> 1215 <Reference name="OpenSim.Framework.Console"/>
1213 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 1216 <Reference name="OpenSim.Framework.Servers.HttpServer"/>