diff --git a/source/masterserver/scripts/desktop_notifications.js b/source/masterserver/scripts/desktop_notifications.js
index 09160311..affb28d3 100644
--- a/source/masterserver/scripts/desktop_notifications.js
+++ b/source/masterserver/scripts/desktop_notifications.js
@@ -88,6 +88,7 @@ function timedRequest()
var table = "
\n"
+ " Version | \n"
+ " Status | \n"
+ + " Game Duration | \n"
+ " Country | \n"
+ " Title | \n"
+ " Techtree | \n"
@@ -159,6 +160,9 @@ function timedRequest()
table += "" + escapeHtml(statusTitle) + " | ";
}
+ /// Game Duration
+ table += "" + escapeHtml(jsonText[i].gameDuration) + " | ";
+
/// Country
if(jsonText[i].country !== "")
{
diff --git a/source/masterserver/showServers.php b/source/masterserver/showServers.php
index 8886c1af..49a0a315 100644
--- a/source/masterserver/showServers.php
+++ b/source/masterserver/showServers.php
@@ -31,7 +31,7 @@
// consider replacing this by a cron job
cleanupServerList();
- $servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL - ' . MAX_HOURS_OLD_GAMES . ' hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients) , ip DESC;' );
+ $servers_in_db = mysql_query( 'SELECT a.*,b.framesToCalculatePlaytime FROM glestserver a LEFT JOIN glestgamestats b ON a.gameUUID = b.gameUUID WHERE status <> 3 OR (status = 3 AND a.lasttime > DATE_add(NOW(), INTERVAL - ' . MAX_HOURS_OLD_GAMES . ' hour)) ORDER BY status, a.lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients) , ip DESC;' );
$all_servers = array();
while ( $server = mysql_fetch_array( $servers_in_db ) )
{
@@ -66,6 +66,7 @@
echo '
' . PHP_EOL;
echo ' Version | ' . PHP_EOL;
echo ' Status | ' . PHP_EOL;
+ echo ' Game Duration | ' . PHP_EOL;
echo ' Country | ' . PHP_EOL;
echo ' Title | ' . PHP_EOL;
echo ' Techtree | ' . PHP_EOL;
@@ -135,6 +136,11 @@
printf( "\t\t\t\t%s | %s", $server['status'], $status_class, htmlspecialchars( $status_title, ENT_QUOTES ), PHP_EOL );
}
+ // Game Stats
+ $gameDuration = $server['framesToCalculatePlaytime'];
+ $gameDuration = getTimeString($gameDuration);
+ printf( "\t\t\t\t%s | %s", htmlspecialchars( $gameDuration, ENT_QUOTES ), PHP_EOL );
+
// country
if ( $server['country'] !== '' ) {
$flagfile = 'flags/' . strtolower( $server['country'] ).'.png';
diff --git a/source/masterserver/showServersJson.php b/source/masterserver/showServersJson.php
index eb78f287..d82fe0e0 100644
--- a/source/masterserver/showServersJson.php
+++ b/source/masterserver/showServersJson.php
@@ -12,11 +12,17 @@
// consider replacing this by a cron job
cleanupServerList();
- $servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL - ' . MAX_HOURS_OLD_GAMES . ' hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' );
+ $servers_in_db = mysql_query( 'SELECT a.*,b.framesToCalculatePlaytime FROM glestserver a LEFT JOIN glestgamestats b ON a.gameUUID = b.gameUUID WHERE status <> 3 OR (status = 3 AND a.lasttime > DATE_add(NOW(), INTERVAL - ' . MAX_HOURS_OLD_GAMES . ' hour)) ORDER BY status, a.lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' );
$all_servers = array();
while ( $server = mysql_fetch_array( $servers_in_db ) )
{
+ // Game Stats
+ $rowIndex = count($all_servers);
+ $gameDuration = $server["framesToCalculatePlaytime"];
+ $server["gameDuration"] = getTimeString($gameDuration);
+
array_push( $all_servers, $server );
+
}
unset( $servers_in_db );
unset( $server );