remvoed the debugs

This commit is contained in:
Frank Harris 2025-11-24 16:21:22 -05:00
parent e13a3b5f8b
commit 75ae6cd870

View file

@ -29,18 +29,6 @@ require_once("modules/config_games/server_config_parser.php");
require_once("includes/refreshed.php");
require_once('includes/lib_remote.php');
if (!function_exists('game_monitor_log')) {
function game_monitor_log($message, array $context = array())
{
$prefix = '[GameMonitor] ';
if (!empty($context)) {
$context_json = json_encode($context, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$message .= ' | context=' . $context_json;
}
error_log($prefix . $message);
}
}
function renderParam($param, $last_param, $param_access_enabled, $home_id)
{
global $db;
@ -160,13 +148,7 @@ function get_sync_name($server_xml)
function exec_ogp_module() {
global $db, $settings, $loggedInUserInfo;
$isAdminUser = $db->isAdmin( $_SESSION['user_id'] );
game_monitor_log('Rendering game monitor', array(
'user_id' => $_SESSION['user_id'],
'is_admin' => $isAdminUser,
'get' => $_GET,
));
echo "<h2 class='gameMonitor " . ($isAdminUser ? "isAdminUser" : "") . "'>". get_lang("game_monitor") ."</h2>";
echo "<h2 class='gameMonitor " . ($db->isAdmin( $_SESSION['user_id'] ) ? "isAdminUser" : "") . "'>". get_lang("game_monitor") ."</h2>";
$refresh = new refreshed();
set_time_limit(0);
$stats_servers_online = 0;
@ -188,7 +170,7 @@ $home_info = $db->getGameHomeWithoutMods($home_id);
$home_limit = $loggedInUserInfo["users_page_limit"];
}
$isAdmin = $isAdminUser;
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
if ( $isAdmin )
{
@ -210,12 +192,6 @@ $home_info = $db->getGameHomeWithoutMods($home_id);
if( $server_homes === FALSE )
{
game_monitor_log('No server homes returned', array(
'user_id' => $_SESSION['user_id'],
'query_scope' => $isAdmin ? 'admin' : 'user_and_group',
'home_cfg_id' => $home_cfg_id,
'search' => $search_field,
));
// If there are no games, then there can not be any mods either.
if (!empty($search_field)) {
@ -318,17 +294,8 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
$j = 1;
foreach( $server_homes as $server_home )
{
game_monitor_log('Processing server home', array(
'home_id' => isset($server_home['home_id']) ? $server_home['home_id'] : null,
'mod_id' => isset($server_home['mod_id']) ? $server_home['mod_id'] : null,
'ip' => isset($server_home['ip']) ? $server_home['ip'] : null,
'home_cfg_file' => isset($server_home['home_cfg_file']) ? $server_home['home_cfg_file'] : null,
));
if( ( $show_all or isset($_GET['home_cfg_id']) ) AND ( !isset($server_home['ip']) or !isset($server_home['mod_id']) ) ){
$j++;
game_monitor_log('Skipping server home due to missing ip or mod_id', array(
'home_id' => $server_home['home_id']
));
continue;
}
// Count the number of servers.
@ -385,12 +352,7 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
}
}
$config_path = SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file'];
game_monitor_log('Loading server config', array(
'home_id' => $server_home['home_id'],
'config_path' => $config_path
));
$server_xml = read_server_config($config_path);
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
$mod = $server_home['mod_key'];
// If query name does not exist use mod key instead.
@ -446,12 +408,6 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
$remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
$host_stat = $remote->status_chk();
game_monitor_log('Agent status check', array(
'home_id' => $server_home['home_id'],
'agent_ip' => $server_home['agent_ip'],
'agent_port' => $server_home['agent_port'],
'status' => $host_stat
));
if( $host_stat === 1)
{
@ -542,11 +498,6 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
$status = "offline";
$order = 3;
$address = "<span style='color:darkred;font-weight:bold;'>Agent Offline</span>";
game_monitor_log('Agent offline', array(
'home_id' => $server_home['home_id'],
'agent_ip' => $server_home['agent_ip'],
'agent_port' => $server_home['agent_port']
));
}
$user = $db->getUserById($server_home['user_id_main']);
@ -583,11 +534,6 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
$j++;
}
echo "</tbody>";
game_monitor_log('Completed server home processing', array(
'user_id' => $_SESSION['user_id'],
'total_servers' => $stats_servers,
'online_servers' => $stats_servers_online
));
echo "<tfoot style='border:1px solid grey;'>
<tr>
@ -637,7 +583,7 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
echo "<div>Put the log file here</div>";
//include("log.php");
?>
<script type="text/javascript">
<?php echo $refresh->build(isset($settings['query_cache_life']) ? $settings['query_cache_life'] * 2000 : 60000); ?>
</script>