Add last startup command display feature
Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
5e41da1247
commit
662582823d
5 changed files with 47 additions and 3 deletions
|
|
@ -3170,6 +3170,36 @@ class OGPDatabaseMySQL extends OGPDatabase
|
|||
return $result['last_param'];
|
||||
}
|
||||
|
||||
public function changeLastStartupCmd($home_id, $command) {
|
||||
$query = sprintf("UPDATE `%sserver_homes` SET `last_startup_cmd` = '%s' WHERE `home_id` = %d",
|
||||
$this->table_prefix,
|
||||
$this->realEscapeSingle($command),
|
||||
$this->realEscapeSingle($home_id));
|
||||
++$this->queries_;
|
||||
if ( mysqli_query($this->link,$query) === FALSE )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function getLastStartupCmd($home_id) {
|
||||
if ( !$this->link ) return FALSE;
|
||||
|
||||
$query = sprintf("SELECT `last_startup_cmd` FROM `%sserver_homes` WHERE `home_id` = %d",
|
||||
$this->table_prefix,
|
||||
$this->realEscapeSingle($home_id));
|
||||
|
||||
++$this->queries_;
|
||||
$result = mysqli_query($this->link,$query);
|
||||
|
||||
if ( mysqli_num_rows($result) != 1 )
|
||||
return FALSE;
|
||||
|
||||
$result = mysqli_fetch_assoc( $result );
|
||||
|
||||
return $result['last_startup_cmd'];
|
||||
}
|
||||
|
||||
public function saveServerStatusCache($ip_id,$port,$status) {
|
||||
$query = sprintf("SELECT * FROM `%sstatus_cache` WHERE `ip_id` = %s AND `port` = %s;",
|
||||
$this->table_prefix,
|
||||
|
|
|
|||
|
|
@ -207,5 +207,6 @@ define('OGP_LANG_phan', "Phantom");
|
|||
define('OGP_LANG_sec', "Seconds");
|
||||
define('OGP_LANG_unknown_rsync_mirror', "You attempted to start an update from a mirror which doesn't exist.");
|
||||
define('OGP_LANG_custom_fields', "Server Settings");
|
||||
define('OGP_LANG_last_startup_command', "Last Startup Command");
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -582,6 +582,8 @@ elseif($server_home['home_id'] == $_POST['home_id'])
|
|||
}
|
||||
//Save the param used to the database
|
||||
$db->changeLastParam($server_home['home_id'],json_encode($save_param));
|
||||
//Save the startup command to the database
|
||||
$db->changeLastStartupCmd($server_home['home_id'], $start_cmd);
|
||||
|
||||
echo "<table class='server-starting'>";
|
||||
echo "<tr><td class='right'>". get_lang("ogp_agent_ip") .
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
// Module general information
|
||||
$module_title = "Game manager";
|
||||
$module_version = "1.33";
|
||||
$db_version = 9;
|
||||
$module_version = "1.34";
|
||||
$db_version = 10;
|
||||
$module_required = TRUE;
|
||||
$module_menus = array( array( 'subpage' => 'game_monitor', 'name'=>'Game Monitor', 'group'=>'user' ) );
|
||||
$module_access_rights = array('u' => 'allow_updates', 'p' => 'allow_parameter_usage', 'e' => 'allow_extra_params', 'c' => 'allow_custom_fields');
|
||||
|
|
@ -117,4 +117,8 @@ $install_queries[9] = array(
|
|||
"ALTER TABLE `".OGP_DB_PREFIX."server_homes` MODIFY COLUMN `home_name` VARCHAR(500);",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."server_homes` MODIFY COLUMN `control_password` VARCHAR(128);",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."server_homes` MODIFY COLUMN `ftp_password` VARCHAR(128);");
|
||||
|
||||
// Add field to store last startup command
|
||||
$install_queries[10] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."server_homes` ADD `last_startup_cmd` LONGTEXT NULL;");
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -436,6 +436,13 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
|
|||
|
||||
$btns = get_monitor_buttons($server_home, $server_xml);
|
||||
|
||||
// Get last startup command for display
|
||||
$last_startup_cmd = $db->getLastStartupCmd($server_home['home_id']);
|
||||
$startup_cmd_display = "";
|
||||
if ($last_startup_cmd) {
|
||||
$startup_cmd_display = "<br><b>". get_lang("last_startup_command") .":</b><br><span style='font-family:monospace; font-size:10px; color:#666; word-wrap: break-word;'>" . htmlentities($last_startup_cmd) . "</span>";
|
||||
}
|
||||
|
||||
//End
|
||||
|
||||
$remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
|
||||
|
|
@ -555,7 +562,7 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
|
|||
$first .= "</tr>";
|
||||
|
||||
$second = "<tr class='expand-child'>";
|
||||
@$second .= "<td colspan='4'>" . $refresh->getdiv($pos,"width:100%;") . "$offlineT</td>";
|
||||
@$second .= "<td colspan='4'>" . $refresh->getdiv($pos,"width:100%;") . "$offlineT" . $startup_cmd_display . "</td>";
|
||||
$second .= "<td class='owner' >$other_owners$groupsus</td>";
|
||||
|
||||
if( $server_xml->protocol != "teamspeak3" OR ($startup_file_exists and $server_xml->protocol == "teamspeak3") OR ($status == "offline" and $server_xml->protocol == "teamspeak3") )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue