aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs (renamed from OpenSim/Region/UserStatistics/WebStatsModule.cs)30
1 files changed, 25 insertions, 5 deletions
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs
index 64cb577..bcb6361 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs
@@ -50,9 +50,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
50using OSD = OpenMetaverse.StructuredData.OSD; 50using OSD = OpenMetaverse.StructuredData.OSD;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap; 51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 52
53[assembly: Addin("WebStats", "1.0")]
54[assembly: AddinDependency("OpenSim", "0.5")]
55
56namespace OpenSim.Region.UserStatistics 53namespace OpenSim.Region.UserStatistics
57{ 54{
58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")]
@@ -121,6 +118,10 @@ namespace OpenSim.Region.UserStatistics
121 reports.Add("clients.report", clientReport); 118 reports.Add("clients.report", clientReport);
122 reports.Add("sessions.report", sessionsReport); 119 reports.Add("sessions.report", sessionsReport);
123 120
121 reports.Add("sim.css", new Prototype_distributor("sim.css"));
122 reports.Add("sim.html", new Prototype_distributor("sim.html"));
123 reports.Add("jquery.js", new Prototype_distributor("jquery.js"));
124
124 //// 125 ////
125 // Add Your own Reports here (Do Not Modify Lines here Devs!) 126 // Add Your own Reports here (Do Not Modify Lines here Devs!)
126 //// 127 ////
@@ -255,9 +256,12 @@ namespace OpenSim.Region.UserStatistics
255 string regpath = request["uri"].ToString(); 256 string regpath = request["uri"].ToString();
256 int response_code = 404; 257 int response_code = 404;
257 string contenttype = "text/html"; 258 string contenttype = "text/html";
259 bool jsonFormatOutput = false;
258 260
259 string strOut = string.Empty; 261 string strOut = string.Empty;
260 262
263 // The request patch should be "/SStats/reportName" where 'reportName'
264 // is one of the names added to the 'reports' hashmap.
261 regpath = regpath.Remove(0, 8); 265 regpath = regpath.Remove(0, 8);
262 if (regpath.Length == 0) regpath = "default.report"; 266 if (regpath.Length == 0) regpath = "default.report";
263 if (reports.ContainsKey(regpath)) 267 if (reports.ContainsKey(regpath))
@@ -265,6 +269,9 @@ namespace OpenSim.Region.UserStatistics
265 IStatsController rep = reports[regpath]; 269 IStatsController rep = reports[regpath];
266 Hashtable repParams = new Hashtable(); 270 Hashtable repParams = new Hashtable();
267 271
272 if (request.ContainsKey("json"))
273 jsonFormatOutput = true;
274
268 if (request.ContainsKey("requestvars")) 275 if (request.ContainsKey("requestvars"))
269 repParams["RequestVars"] = request["requestvars"]; 276 repParams["RequestVars"] = request["requestvars"];
270 else 277 else
@@ -284,13 +291,26 @@ namespace OpenSim.Region.UserStatistics
284 291
285 concurrencyCounter++; 292 concurrencyCounter++;
286 293
287 strOut = rep.RenderView(rep.ProcessModel(repParams)); 294 if (jsonFormatOutput)
295 {
296 strOut = rep.RenderJson(rep.ProcessModel(repParams));
297 contenttype = "text/json";
298 }
299 else
300 {
301 strOut = rep.RenderView(rep.ProcessModel(repParams));
302 }
288 303
289 if (regpath.EndsWith("js")) 304 if (regpath.EndsWith("js"))
290 { 305 {
291 contenttype = "text/javascript"; 306 contenttype = "text/javascript";
292 } 307 }
293 308
309 if (regpath.EndsWith("css"))
310 {
311 contenttype = "text/css";
312 }
313
294 concurrencyCounter--; 314 concurrencyCounter--;
295 315
296 response_code = 200; 316 response_code = 200;
@@ -397,7 +417,7 @@ namespace OpenSim.Region.UserStatistics
397 Encoding encoding = Encoding.ASCII; 417 Encoding encoding = Encoding.ASCII;
398 int sizeOfChar = encoding.GetByteCount("\n"); 418 int sizeOfChar = encoding.GetByteCount("\n");
399 byte[] buffer = encoding.GetBytes("\n"); 419 byte[] buffer = encoding.GetBytes("\n");
400 string logfile = Util.logDir() + "/" + "OpenSim.log"; 420 string logfile = Util.logFile();
401 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 421 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
402 Int64 tokenCount = 0; 422 Int64 tokenCount = 0;
403 Int64 endPosition = fs.Length / sizeOfChar; 423 Int64 endPosition = fs.Length / sizeOfChar;