Merge pull request #99 from GameServerPanel/copilot/remove-legacy-install-methods

Remove rsync/manual install methods; standardize SteamCMD pipeline; fix Update button
This commit is contained in:
Frank Harris 2026-05-02 08:12:35 -07:00 committed by GitHub
commit 6465632097
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 71 additions and 1000 deletions

View file

@ -297,55 +297,6 @@ function send_rcon_command($command, $remote, $server_xml, $home_info, $home_id,
}
}
function test_rsync_response($address)
{
$starttime = microtime(true);
$fp = fsockopen($address, 873, $errno, $errstr, 3);
$stoptime = microtime(true);
if (!$fp) {
return FALSE;
}
else
{
$out = "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$response = "";
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
if(strstr($response,"@RSYNCD"))
{
$response_time = ($stoptime - $starttime);
return $response_time;
}
else
return FALSE;
}
}
function get_faster_rsync($rsync_sites)
{
$faster = "NONE";
foreach ((array)$rsync_sites as $site)
{
list($url,$name) = explode('|', $site);
$current_time = test_rsync_response($url);
if($response_time !== FALSE)
{
if(!isset($previous_time))
$faster = $url;
if($previous_time > $current_time)
$faster = $url;
$previous_time = $current_time;
}
}
if($faster == "NONE")
$faster = "rsync.opengamepanel.org";
return $faster;
}
function get_download_filename($url)
{
if(empty($url) or !filter_var($url, FILTER_VALIDATE_URL))

View file

@ -44,42 +44,6 @@ function create_back_button($module,$subpage = "")
return $retval;
}
/// Creates HTML drop box from given array with the given listname, custom for Rsync sites
function create_drop_box_from_array_rsync($input_array, $listname, $current_value = "", $use_only_values = true)
{
$count = 1;
$retval = "<select id=\"$listname\" name=\"$listname\">\n";
foreach ((array)$input_array as $key => $value)
{
$value = trim($value);
list($rsync_site,$location) = explode("|", $value);
// We want to print lines with zeros, but not empty lines.
if ( $value !== "0" && empty($value) )
{
continue;
}
if ( $use_only_values === true )
{
# $key = $value;
}
if ( $key == $current_value )
{
$retval .= "<option value='$count' selected='selected'>$rsync_site - $location</option>\n";
}
else
{
$retval .= "<option value='$count'>$rsync_site - $location</option>\n";
}
++$count;
}
$retval .= "</select>\n";
return $retval;
}
/// Creates HTML drop box from given array with the given listname.
function create_drop_box_from_array($input_array,$listname,$current_value = "", $use_only_values = true)
{

View file

@ -492,36 +492,6 @@ class OGPRemoteLibrary
/// \return -1 If could not connect to the remote host.
/// \return -3 In case of unknown error
/// \todo This function is not complete. Also the agent side requires work.
public function start_rsync_install($home_id,$home_path,$url,$exec_folder_path,$exec_path,$precmd,$postcmd,$filesToLock="")
{
$params_array = $this->encrypt_params($home_id,$home_path,$url,$exec_folder_path,$exec_path,$precmd,$postcmd,$filesToLock);
$this->add_enc_chk($params_array);
$request = xmlrpc_encode_request("start_rsync_install",$params_array);
$response = $this->sendRequest($request);
if ( $response === 1 )
return 1;
else if ( $response === 0 )
return 0;
else
return -1;
}
public function rsync_progress($home)
{
$args = $this->encryptParam($home);
$this->add_enc_chk($args);
$request = xmlrpc_encode_request("rsync_progress",$args);
$response = $this->sendRequest($request);
if( !$response )
return -1;
#if (is_array($response) && xmlrpc_is_fault($response))
# return -3;
return $response;
}
/// \return array of files in directory, when request success.
/// \return -1 If unable to connect to the remote server.
/// \return -2 In case directory was not accessible.

View file

@ -29,8 +29,8 @@ define('OGP_LANG_no_game_homes_assigned', "You don't have any servers assigned t
define('OGP_LANG_select_game_home_to_configure', "Select a game server that you want to configure");
define('OGP_LANG_file_manager', "File Manager");
define('OGP_LANG_configure_mods', "Configure mods");
define('OGP_LANG_install_update_steam', "Install/Update");
define('OGP_LANG_install_update_manual', "Install/Update");
define('OGP_LANG_install_update_steam', "Update");
define('OGP_LANG_install_update_manual', "Update");
define('OGP_LANG_assign_game_homes', "Assign game servers");
define('OGP_LANG_user', "User");
define('OGP_LANG_group', "Group");
@ -130,7 +130,6 @@ define('OGP_LANG_error_occured_remote_host', "Error occurred on the remote host"
define('OGP_LANG_follow_server_status', "You can follow the server status from");
define('OGP_LANG_addons', "Addons");
define('OGP_LANG_hostname', "Hostname");
define('OGP_LANG_rsync_install', "[Rsync Install]");
define('OGP_LANG_ping', "Ping");
define('OGP_LANG_team', "Team");
define('OGP_LANG_deaths', "Deaths");
@ -142,7 +141,7 @@ define('OGP_LANG_player', "Player");
define('OGP_LANG_port', "Port");
define('OGP_LANG_rcon_presets', "RCON presets");
define('OGP_LANG_update_from_local_master_server', "Update from local Master Server");
define('OGP_LANG_update_from_selected_rsync_server', "Update from selected Rsync server");
define('OGP_LANG_update_from_selected_rsync_server', "Update from selected server");
define('OGP_LANG_execute_selected_server_operations', "Execute selected server operations");
define('OGP_LANG_execute_operations', "Execute operations");
define('OGP_LANG_account_expiration', "Account expiration");
@ -207,5 +206,4 @@ 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");
?>

View file

@ -70,11 +70,6 @@ define('OGP_LANG_editable_email', "Editable E-Mail Address");
define('OGP_LANG_editable_email_info', "Select if users can edit their e-mail address or not.");
define('OGP_LANG_old_dashboard_behavior', "Old Dashboard behavior");
define('OGP_LANG_old_dashboard_behavior_info', "The old Dashboard was running slower, but shows more server informations (e.g. current players and maps).");
define('OGP_LANG_rsync_available', "Available Rsync servers");
define('OGP_LANG_rsync_available_info', "Select what servers list will be shown in the rsync installation.");
define('OGP_LANG_all_available_servers', "All available servers ( rsync_sites.list + rsync_sites_local.list )");
define('OGP_LANG_only_remote_servers', "Only remote servers ( rsync_sites.list )");
define('OGP_LANG_only_local_servers', "Only local servers ( rsync_sites_local.list )");
define('OGP_LANG_header_code', "Header code");
define('OGP_LANG_header_code_info', "Here you can write your own header code (like HTML code, Embed Code etc.) without editing the theme layout.");
define('OGP_LANG_support_widget_title', "Support widget title");

View file

@ -229,66 +229,47 @@ function exec_ogp_module()
}
//Install files for this service in the remote server
// -Steam
$exec_folder_path = clean_path($home_info['home_path'] . "/" . $server_xml->exe_location );
$exec_path = clean_path($exec_folder_path . "/" . $server_xml->server_exec_name );
if ($install_method == "steam")
if ( (string)$server_xml->installer === "steamcmd" && !empty((string)$installer_name) )
{
if ( $server_xml->installer == "steamcmd" )
{
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
$cfg_os = "windows";
elseif( preg_match("/linux/", $server_xml->game_key) )
$cfg_os = "linux";
// Some games like L4D2 require anonymous login
if($mod_xml->installer_login){
$login = $mod_xml->installer_login;
$pass = '';
}else{
$login = $settings['steam_user'];
$pass = $settings['steam_pass'];
}
$modname = ( $installer_name == '90' and !preg_match("/(cstrike|valve)/", $modkey) ) ? $modkey : '';
$betaname = isset($mod_xml->betaname) ? $mod_xml->betaname : '';
$betapwd = isset($mod_xml->betapwd) ? $mod_xml->betapwd : '';
$arch = isset($mod_xml->steam_bitness) ? $mod_xml->steam_bitness : '';
$remote->steam_cmd( $home_id,$home_info['home_path'],$installer_name,$modname,
$betaname,$betapwd,$login,$pass,$settings['steam_guard'],
$exec_folder_path,$exec_path,$precmd,$postcmd,$cfg_os,'',$arch);
}
}
// -Rsync
elseif ($install_method == "rsync")
{
//Rsync Server
$url = "files.iaregamer.com";
//OS
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
$os = "windows";
$cfg_os = "windows";
elseif( preg_match("/linux/", $server_xml->game_key) )
$os = "linux";
//Rsync Game Name
//JUST SET RS_GNAME TO GAME xml NAME
$rs_gname = $server_xml->game_key;
//Starting Sync
$full_url = "$url/rsync_installer/$rs_gname/$os/";
$remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$precmd,$postcmd);
$cfg_os = "linux";
// Some games like L4D2 require anonymous login
if($mod_xml->installer_login){
$login = $mod_xml->installer_login;
$pass = '';
}else{
$login = $settings['steam_user'];
$pass = $settings['steam_pass'];
}
$modname = ( $installer_name == '90' and !preg_match("/(cstrike|valve)/", $modkey) ) ? $modkey : '';
$betaname = isset($mod_xml->betaname) ? $mod_xml->betaname : '';
$betapwd = isset($mod_xml->betapwd) ? $mod_xml->betapwd : '';
$arch = isset($mod_xml->steam_bitness) ? $mod_xml->steam_bitness : '';
$remote->steam_cmd( $home_id,$home_info['home_path'],$installer_name,$modname,
$betaname,$betapwd,$login,$pass,$settings['steam_guard'],
$exec_folder_path,$exec_path,$precmd,$postcmd,$cfg_os,'',$arch);
}
// -Manual
elseif ($install_method == "manual")
else
{
// Start File Download and uncompress
$filename = !empty($manual_url) ? substr($manual_url, -9) : "";
$remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress");
// No SteamCMD installer — run pre/post install scripts only.
if (!empty((string)$precmd)) {
$result = $remote->exec((string)$precmd);
if ($result === NULL)
$db->logger("Script-only install: pre_install script returned no output for home_id $home_id");
}
if (!empty((string)$postcmd)) {
$result = $remote->exec((string)$postcmd);
if ($result === NULL)
$db->logger("Script-only install: post_install script returned no output for home_id $home_id");
}
}
echo "<h4><br><p>".get_lang('starting_installations')."</p></h4><br>";
//PANEL LOG

View file

@ -46,55 +46,21 @@ if (preg_match("/u/",$server_home['access_rights']))
$master_server_home_id = FALSE;
}
}
// In case game is compatible with steam we offer a way to use steam with the updates.
if( $server_xml->installer == "steamcmd" )
{
if( $master_server_home_id != FALSE AND $master_server_home_id != $server_home['home_id'] )
{
$module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;master_server_home_id=".$master_server_home_id."&amp;update=update'>
<img src='" . check_theme_image("images/master.png") . "' title='". get_lang("update_from_local_master_server") ."'>
<span>". get_lang("update_from_local_master_server") ."</span>
</a>";
}
//$module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
$module_buttons[] = "<a class='monitorbutton' href='javascript:confirmarUpdateSteam();'>
<img src='" . check_theme_image("images/steam.png") ."' title='". get_lang("install_update_manually") ."'>
<span>". get_lang("install_update_steam") ."</span>
</a>
<script>
function confirmarUpdateSteam(){
if (confirm('If you continue, you will overwrite any configuration files. BACKUP IMPORTANT FILES!')) {
window.location.href = '?m=gamemanager&p=update&home_id=".$server_home['home_id']."&mod_id=".$server_home['mod_id']."&update=update';
}
}
</script>";
$hasSteamAutoUpdate = true;
}
// In other cases manual update is provided.
if( $server_xml->installer == "manual" )
// Master-server copy update (available regardless of installer type).
if( $master_server_home_id != FALSE AND $master_server_home_id != $server_home['home_id'] )
{
$module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update_manual&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
<img src='" . check_theme_image("images/install.png") . "' title='". get_lang("install_update_manual") ."'>
<span>". get_lang("install_update_manual") ."</span>
$module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;master_server_home_id=".$master_server_home_id."&amp;update=update'>
<img src='" . check_theme_image("images/master.png") . "' title='". get_lang("update_from_local_master_server") ."'>
<span>". get_lang("update_from_local_master_server") ."</span>
</a>";
}
// In other cases rsync update is provided.
if( $server_xml->installer == "rsync" )
{
$sync_name = $server_xml->game_key;
$sync_list = @file("modules/gamemanager/rsync.list", FILE_IGNORE_NEW_LINES);
if ( (is_array($sync_list) && in_array($sync_name, $sync_list)) OR ($master_server_home_id != FALSE and $master_server_home_id != $server_home['home_id']) )
{
$module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=rsync_install&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
<img src='" . check_theme_image("images/rsync.png") . "' title='". rsync_install ."'>
<span>". get_lang("rsync_install") ."</span>
</a>";
}
}
// Update button — runs SteamCMD (validate) for steam games, or install scripts for others.
$module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
<img src='" . check_theme_image("images/steam.png") ."' title='". get_lang("update_server") ."'>
<span>". get_lang("update_server") ."</span>
</a>";
$hasSteamAutoUpdate = true;
/*
$module_buttons[] = "<a class='monitorbutton getAPILinks' hassteam='" . ($hasSteamAutoUpdate ? 'true' : 'false') . "' hasrcon='" . ($server_xml->control_protocol || ($server_xml->lgsl_query_name and $server_xml->lgsl_query_name == "7dtd") || ($server_xml->gameq_query_name and $server_xml->gameq_query_name == "minecraft") ? 'true' : 'false') . "' copyfail='" . get_lang("auto_update_copy_me_fail") . "' copysuccess='" . get_lang("auto_update_copy_me_success") . "' autoupdatetext='" . get_lang("auto_update_title_popup") . "' copyme='" . get_lang("auto_update_copy_me") . "' token='".$db->getApiToken($_SESSION['user_id'])."' ip='".$server_home['ip']."' port='".$server_home['port']."' modkey='".$server_home['mod_key']."' panelurl='" . getOGPSiteURL() . "'>

View file

@ -4,8 +4,7 @@
<page key="stop" file="stop_server.php" access="admin,user,subuser" />
<page key="restart" file="restart_server.php" access="admin,user,subuser" />
<page key="update" file="update_server.php" access="admin,user,subuser" />
<page key="update_manual" file="update_server_manual.php" access="admin,user,subuser" />
<page key="rsync_install" file="rsync_install.php" access="admin,user,subuser" />
<page key="log" file="view_server_log.php" access="admin,user,subuser" />
<page key="rcon_presets" file="rcon_presets.php" access="admin" />
<page key="upload_map_image" file="upload_map_image.php" access="admin" />

View file

@ -1,15 +0,0 @@
bec_win64
bf2
bigbrotherbot_linux32
cstrike_linux32
dod_linux32
fivem_linux32
minecraft_linux64
mumble_linux32
pixark_win64
spigot
spunkybot_linux64
steamcmd
terraria_linux
urt_linux
ut99_linux32

View file

@ -1,417 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
function do_progress($kbytes,$rsyncPath)
{
$mbytes = round($kbytes / 1024, 2);
$sizes = file("modules/gamemanager/sizes.list", FILE_IGNORE_NEW_LINES)or print_failure("Can't open sizes.list");
if (!is_array($sizes)) {
$sizes = [];
}
# Adds a backslash on each slash so it can be used as patern at preg_match
$rsyncPath = addcslashes($rsyncPath,"/");
# Sets a default file size
$totalsize = 0;
# loops all available sizes to work over a string instead of an array.
foreach ((array)$sizes as $key => $size)
{
# If the rsync path matches the path at the string on the variable $size
# then lists the path and the total size on separated variables
# using explode over the string saved on $size
if ( preg_match("/$rsyncPath/i", $size) )
list( $path, $totalsize ) = explode( ";", $size );
}
if($kbytes > 0)
{
$pct = round(( $kbytes / $totalsize ) * 100, 2);
}
else
{
$pct = "unavailable";
}
#echo "Percent is $pct";
$pct = $pct > 100 ? 100 : $pct;
return "$totalsize;$mbytes;$pct";
}
function update_local_copies()
{
$last_updated = filemtime("modules/gamemanager/sizes.list");
$nowtime=time();
$diff = $nowtime - $last_updated;
if( $diff < 86400)
{
#echo "Now $nowtime last $last_updated diff $diff<br>";
return 0;
}
echo "Updating local cache of rsync meta data files<br>";
$update_files = array('sizes.list', 'rsync.list', 'rsync_sites.list');
$update_urls = array('rsync.opengamepanel.org', 'dls.atl.webehostin.com');
$context = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
foreach ((array)$update_files as $file_chk)
{
#echo "Trying to update $file_chk<br>";
foreach ((array)$update_urls as $site)
{
#echo "Trying $file_chk from $site<br>";
if(!is_writable("modules/gamemanager/$file_chk"))
{
print_failure("modules/gamemanager/$file_chk is not writable...please make it writable by the webserver");
}
if($tmp_content = file_get_contents("http://$site/sync_data/$file_chk", false, $context))
{
if(!file_put_contents("modules/gamemanager/$file_chk",$tmp_content)){echo "Failed to write<br>";};
break;
}
}
}
if(is_writable('modules/gamemanager'))
{
$tmp = 'modules/gamemanager';
}
elseif(is_writable('/tmp'))
{
$tmp = 'modules/gamemanager';
}
else
{
return "-1";
}
}
require_once("includes/lib_remote.php");
require_once("modules/config_games/server_config_parser.php");
function exec_ogp_module() {
//update_local_copies(); #Disabled until the rsync_sites.list file from master servers is corrected.
global $db,$view,$settings;
$home_id = isset($_REQUEST['home_id']) ? $_REQUEST['home_id'] : "";
$mod_id = isset($_REQUEST['mod_id']) ? $_REQUEST['mod_id'] : "";
$state = isset($_POST['state']) ? $_POST['state'] : "";
$update = isset($_GET['update']) ? $_GET['update'] : "";
$rsync_remote_sites = file("modules/gamemanager/rsync_sites.list"); #load offical rsync sites
$rsync_local_sites = file("modules/gamemanager/rsync_sites_local.list"); #load user custom sites
$settings['rsync_available'] = isset($settings['rsync_available']) ? $settings['rsync_available'] : "1";
if(is_array($rsync_local_sites) && $settings['rsync_available'] == "1") {
$rsync_sites = array_merge($rsync_remote_sites, $rsync_local_sites);
} elseif($settings['rsync_available'] == "2") {
$rsync_sites = $rsync_remote_sites;
} elseif( $settings['rsync_available'] == "3") {
$rsync_sites = $rsync_local_sites;
}
$isAdmin = $db->isAdmin($_SESSION['user_id']);
if ($isAdmin) {
$home_info = $db->getGameHome($home_id);
} else {
$home_info = $db->getUserGameHome($_SESSION['user_id'],$home_id);
}
if ( $home_info === FALSE || preg_match("/u/",$home_info['access_rights']) != 1 )
{
print_failure( get_lang("no_rights") );
echo create_back_button("gamemanager","game_monitor");
return;
}
$home_id = $home_info['home_id'];
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
if( isset($server_xml->lgsl_query_name) )
{
$lgslname = $server_xml->lgsl_query_name;
if($lgslname == "quake3")
{
if($server_xml->game_name == "Quake 3")
$lgslname = "q3";
}
}
elseif( isset($server_xml->gameq_query_name) )
{
$lgslname = $server_xml->gameq_query_name;
if($lgslname == "minecraft")
{
if($server_xml->game_name == "Bukkit")
$lgslname = "bukkit";
elseif($server_xml->game_name == "Tekkit")
$lgslname = "tekkit";
}
}
elseif( isset($server_xml->protocol) )
$lgslname = $server_xml->protocol;
else
$lgslname = $server_xml->mods->mod['key'];
//SKIP ABOVE AND JUST SET RS_GNAME TO GAME xml NAME
$rs_gname = $server_xml->game_key;
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
$os = "windows";
elseif( preg_match("/linux/", $server_xml->game_key) )
$os = "linux";
echo "<h2>Update $home_info[home_name]</h2>";
if ( $remote->is_screen_running(OGP_SCREEN_TYPE_HOME,$home_id) == 1 )
{
print_failure( get_lang("server_running_cant_update") );
return;
}
$update_active = $remote->get_log(OGP_SCREEN_TYPE_UPDATE,
// Note exec location should not be added here as the log is in root where rsync is executed.
$home_id,clean_path($home_info['home_path']),
$log_txt,30);
if ($update_active === 0)
{
print_failure( get_lang("agent_offline") );
$view->refresh("{CURRENT_PAGE}", 5);
return;
}
// Start update.
elseif ($state == 'start' && $update_active != 1)
{
$precmd = $home_info['mods'][$mod_id]['precmd'] == "" ?
( $home_info['mods'][$mod_id]['def_precmd'] == "" ? $server_xml->pre_install :
$home_info['mods'][$mod_id]['def_precmd'] ) : $home_info['mods'][$mod_id]['precmd'];
$postcmd = $home_info['mods'][$mod_id]['postcmd'] == "" ?
( $home_info['mods'][$mod_id]['def_postcmd'] == "" ? $server_xml->post_install :
$home_info['mods'][$mod_id]['def_precmd'] ) : $home_info['mods'][$mod_id]['postcmd'];
$exec_folder_path = clean_path($home_info['home_path'] . "/" . $server_xml->exe_location );
$exec_path = clean_path($exec_folder_path . "/" . $server_xml->server_exec_name );
if( isset( $_REQUEST['master_server_home_id'] ) )
{
$ms_home_id = $_REQUEST['master_server_home_id'];
if ($db->getMasterServer($home_info['remote_server_id'], $home_info['home_cfg_id']) == $ms_home_id) {
if ($ms_home_id !== $home_id) {
$ms_info = $db->getGameHome($ms_home_id);
print_success(get_lang_f("starting_copy_with_master_server_named",htmlentities($ms_info['home_name'])));
$rsync = $remote->masterServerUpdate( $home_id,$home_info['home_path'],$ms_home_id,$ms_info['home_path'],$exec_folder_path,$exec_path,$precmd,$postcmd );
$master = "&amp;master=true";
} else {
print_failure(get_lang('cannot_update_from_own_self'));
$view->refresh('?m=gamemanager&p=game_monitor', 2);
return;
}
} else {
$db->logger(get_lang_f('update_attempt_from_nonmaster_server', $_SESSION['users_login'], $home_id, $ms_home_id));
print_failure(get_lang('attempting_nonmaster_update'));
$view->refresh('?m=gamemanager&p=game_monitor', 2);
return;
}
}
else
{
$url_id = (isset($_POST['url_id']) && (int)$_POST['url_id'] > 0 ? (int)$_POST['url_id'] -1 : null);
if (!is_null($url_id) && array_key_exists($url_id, (array)$rsync_sites)) {
$urlArr = explode('|', $rsync_sites[$url_id]);
$url = $urlArr[0] . "/rsync_installer/$rs_gname/$os/";
} else {
print_failure(get_lang('unknown_rsync_mirror'));
$view->refresh('?m=gamemanager&p=game_monitor');
return;
}
print_success(get_lang_f("starting_sync_with", $url));
// Additional files to lock
if(isset($server_xml->lock_files) && !empty($server_xml->lock_files)){
$lockFiles = trim($server_xml->lock_files);
}else{
$lockFiles = "";
}
$rsync = $remote->start_rsync_install($home_id, $home_info['home_path'], $url, $exec_folder_path, $exec_path, $precmd, $postcmd, $lockFiles);
$master = "";
}
if( $rsync === 0 )
{
print_failure( get_lang("failed_to_start_rsync_update") );
return;
}
else if ( $rsync === 1 )
{
print_success(get_lang("update_started"));
echo "<p><a href=\"?m=gamemanager&amp;p=rsync_install&amp;update=refresh&amp;home_id=$home_id&amp;mod_id=$mod_id$master\">".
get_lang("refresh_rsync_status") ."</a></p>";
$view->refresh("?m=gamemanager&amp;p=rsync_install&amp;update=refresh&amp;home_id=$home_id&amp;mod_id=$mod_id$master",5);
return;
}
elseif( $rsync === 0 )
{
print_failure( get_lang("agent_offline") );
return;
}
}
elseif($update_active == 1)
{
echo "<p class='note'></p>\n";
if ( isset( $_POST['stop_update_x'] ) )
{
$remote->stop_update($home_id);
print_success("Update stopped.");
$view->refresh("?m=gamemanager&amp;p=rsync_install&amp;update=refresh&amp;home_id=$home_id&amp;mod_id=$mod_id", 2);
return;
}
$update_complete = false;
echo "<form method=POST><input type='image' name='stop_update' onsubmit='submit-form();' src='modules/administration/images/remove.gif'>". get_lang("stop_update") ."</input></form>";
if (empty($log_txt))
$log_txt = not_available;
if(!isset($_GET['master']))
{
$kbytes = $remote->rsync_progress($home_info['home_path']);
list($totalsize,$mbytes,$pct) = explode(";",do_progress($kbytes,$rs_gname."/".$os));
$totalmbytes = round($totalsize / 1024, 2);
echo '<div class="dragbox bloc rounded" style="background-color:#dce9f2;" >
<h4>'. get_lang("update_in_progress") ." ${mbytes}MB/${totalmbytes}MB</h4>
<div style='background-color:#dce9f2;' >
";
$bar = '';
for( $i = 1; $i <= $pct; $i++ )
{
$bar .= '<img style="width:0.92%;vertical-align:middle;" src="images/progressBar.png">';
}
echo "$bar <b style='vertical-align:top;display:inline;font-size:1.2em;color:red;' >$pct%</b>
</div>
</div><br>";
}
else
{
echo '<h4>'. get_lang("update_in_progress") .'</h4>';
}
echo "<pre>".$log_txt."</pre>\n".
"<p><a href=\"?m=gamemanager&amp;p=rsync_install&amp;update=refresh&amp;home_id=$home_id&amp;mod_id=$mod_id\">".
get_lang("refresh_rsync_status") ."</a></p>";
$view->refresh("?m=gamemanager&amp;p=rsync_install&amp;update=refresh&amp;home_id=$home_id&amp;mod_id=$mod_id",5);
return;
}
elseif($update != "update")
{
$view->refresh("{CURRENT_PAGE}", 60);
print_success(get_lang("update_completed") );
echo "<table class='center'><tr><td><a href='?m=gamemanager&amp;p=game_monitor&amp;home_id=".$home_info['home_id']."'><< ". get_lang("back") ."</a></td></tr></table>";
echo "<pre>".$log_txt."</pre>\n";
echo "<table class='center'><tr><td><a href='?m=gamemanager&amp;p=game_monitor&amp;home_id=".$home_info['home_id']."'><< ". get_lang("back") ."</a></td></tr></table>";
$update_complete = true;
}
else
{
#echo "LGSL or GameQ query name is $server_xml->lgsl_query_name$server_xml->gameq_query_name";
$sync_list = @file("modules/gamemanager/rsync.list", FILE_IGNORE_NEW_LINES);
if(!is_array($sync_list))
{
if(!is_file("modules/gamemanager/rsync.list"))
{
print_failure("Trouble accessing http://www.opengamepanel.org/rsync.list<br>".
"Make sure allow_fopen_url is set to \"On\" in your php.ini and opengamepanel.org is online<br>".
"In the mean time, you can get a local copy of the file by running wget http://www.opengamepanel.org/sync_data/rsync.list -O /path/to/ogpweb/modules/gamemanager/rsync.list");
return;
}
# print_failure("Error loading rsync.list");
# return;
$sync_list = @file("modules/gamemanager/rsync.list", FILE_IGNORE_NEW_LINES);
if(!is_array($sync_list))
{
print_failure("Failed to open local copy of rsync.list in modules/gamemanager/rsync.list");
return;
}
}
$master_server_home_id = $db->getMasterServer( $home_info['remote_server_id'], $home_info['home_cfg_id'] );
if ( is_array($sync_list) && in_array($rs_gname, $sync_list) )
{
echo "<form action='?m=gamemanager&amp;p=rsync_install' method='post'>
<table class='center'>
<input type='hidden' name='home_id' value='$home_id' />
<input type='hidden' name='mod_id' value='$mod_id' />
<input type='hidden' name='lgslname' value='$rs_gname' />
<input type='hidden' name='state' value='start' />
<tr><td align='right'>Game name:</td><td align='left'>$home_info[game_name]</td></tr>
<tr><td align='right'>Directory:</td><td align='left'>$home_info[home_path]</td></tr>
<tr><td align='right'>Remoteserver:</td>
<td align='left'>$home_info[remote_server_name] ($home_info[agent_ip]:$home_info[agent_port])</td></tr>
<tr><td align='right'>Rsync Server:</td>
<td align='left'>".create_drop_box_from_array_rsync($rsync_sites,"url_id")."<br>";
if( $master_server_home_id != FALSE AND $master_server_home_id != $home_id )
{
echo "<input type='checkbox' name='master_server_home_id' value='$master_server_home_id' /><b>". get_lang("update_from_local_master_server") ."</b>";
}
echo "</td></tr></table><p><input type='submit' name='update' value='". get_lang("update_from_selected_rsync_server") ."' /></p>
</form>";
}
elseif($master_server_home_id != FALSE AND $master_server_home_id != $home_id)
{
$ms_home_info = $db->getGameHome($master_server_home_id);
echo "<br>
<p class='success'>Master server update available</p><br>
<form action='?m=gamemanager&amp;p=rsync_install' method='post'>
<table class='center'>
<input type='hidden' name='home_id' value='$home_id' />
<input type='hidden' name='mod_id' value='$mod_id' />
<input type='hidden' name='lgslname' value='$rs_gname' />
<input type='hidden' name='state' value='start' />
<tr><td align='right'>Game name:</td><td align='left'>$home_info[game_name]</td></tr>
<tr><td align='right'>Master Server Name:</td><td align='left'>$ms_home_info[home_name]</td></tr>
<tr><td align='right'>Master Server Directory:</td><td align='left'>$ms_home_info[home_path]</td></tr>
<tr><td align='right'>Local Directory:</td><td align='left'>$home_info[home_path]</td></tr>".
"<input type='hidden' name='master_server_home_id' value='$master_server_home_id' />".
"</td></tr></table><p><input type='submit' name='update' value='". get_lang("update_from_local_master_server") ."' /></p>
</form>";
}
else
{
print_failure("This game type [ $lgslname ] is not yet supported with rsync install");
}
}
}
?>

View file

@ -1,2 +0,0 @@
files.iareserver.com|Kansas City USA

View file

@ -1 +0,0 @@
files.iareserver.com|Kansas City USA

View file

@ -1,34 +0,0 @@
bec_win64/windows;27024
bf2/linux;12816
bf2/windows;21364
bigbrotherbot_linux32/linux;10004
cstrike_linux32/cstrike_install.sh;4
cstrike_linux32/linux;807732
dod_linux32/dod_install.sh;4
dod_linux32/linux;808656
fivem_linux32/linux;132144
fivem_linux32/update.sh;4
minecraft_linux64/linux;91296
mumble_linux32/linux;36512
pixark_win64/windows;4
spigot/BuildData;36348
spigot/BuildTools.jar;3904
spigot/BuildTools.log.txt;1064
spigot/Bukkit;10592
spigot/CraftBukkit;27536
spigot/Spigot;117616
spigot/apache-maven-3.6.0;10608
spigot/spigot-1.15.2.jar;31744
spigot/work;177760
spunkybot_linux64/linux;1740
steamcmd/linux32;36320
steamcmd/linux64;29016
steamcmd/package;51604
steamcmd/public;224
steamcmd/siteserverui;145048
steamcmd/steam;484
steamcmd/steamcmd.sh;4
steamcmd/steamcmd_linux.tar.gz;2372
terraria_linux/linux;52088
urt_linux/linux;1450964
ut99_linux32/linux;291268

View file

@ -54,11 +54,8 @@ function exec_ogp_module() {
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
if ( $server_xml->installer != "steamcmd" )
{
print_failure( get_lang("xml_steam_error") );
return;
}
$use_steamcmd = ((string)$server_xml->installer === "steamcmd");
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'], $home_info['timeout']);
$host_stat = $remote->status_chk();
if( $host_stat === 0 )
@ -134,7 +131,7 @@ function exec_ogp_module() {
}
}
else
elseif ($use_steamcmd && !empty((string)$installer_name))
{
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
$cfg_os = "windows";
@ -168,6 +165,26 @@ function exec_ogp_module() {
$betaname,$betapwd,$login,$pass,$settings['steam_guard'],
$exec_folder_path,$exec_path,$precmd,$postcmd,$cfg_os,$lockFiles,$arch);
}
else
{
// No SteamCMD installer — run pre/post install scripts only.
$ran_scripts = false;
if (!empty((string)$precmd)) {
$remote->exec((string)$precmd);
$ran_scripts = true;
}
if (!empty((string)$postcmd)) {
$remote->exec((string)$postcmd);
$ran_scripts = true;
}
if ($ran_scripts) {
print_success( get_lang("update_started") );
} else {
print_success( get_lang("update_completed") );
}
$view->refresh("?m=gamemanager&amp;p=game_monitor&amp;home_id=$home_id", 3);
return;
}
if( $steam_out === 0 )
{

View file

@ -1,168 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
function do_progress($kbytes,$totalsize)
{
$mbytes = round($kbytes / 1024, 2);
if($kbytes > 0)
{
$pct = round(( $kbytes / $totalsize ) * 100, 2);
}
else
{
$pct = unavailable;
}
#echo "Percent is $pct";
return "$totalsize;$mbytes;$pct";
}
require_once("includes/lib_remote.php");
require_once("modules/config_games/server_config_parser.php");
function exec_ogp_module() {
global $db, $view;
$home_id = isset($_REQUEST['home_id']) ? $_REQUEST['home_id'] : "";
$mod_id = isset($_REQUEST['mod_id']) ? $_REQUEST['mod_id'] : "";
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
if($isAdmin)
$home_info = $db->getGameHome($home_id);
else
$home_info = $db->getUserGameHome($_SESSION['user_id'],$home_id);
if ( $home_info === FALSE || preg_match("/u/",$home_info['access_rights']) != 1 )
{
print_failure( get_lang("no_rights") );
echo create_back_button("gamemanager","gamemanager");
return;
}
$home_id = $home_info['home_id'];
$state = isset($_REQUEST['state']) ? $_REQUEST['state'] : "";
$pid = isset($_REQUEST['pid']) ? $_REQUEST['pid'] : -1;
$filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : "";
echo "<h2>". get_lang("install_update_manual") ." $home_info[home_name]</h2>";
if ( !empty($state) )
{
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
if ( $state == "start" )
{
$postinstall = $server_xml->post_install ? $server_xml->post_install : "";
$pid = $remote->start_file_download($_REQUEST['url'],$home_info['home_path'],
$filename,"uncompress",$postinstall);
if ( $pid < 0 )
{
print_failure( get_lang("failed_to_start_file_download") );
return;
}
}
$url = $_REQUEST['url'];
$headers = get_headers($url, 1);
$download_available = !$headers ? FALSE : TRUE;
// Check if any error occured
if($download_available)
{
$bytes = is_array($headers['Content-Length']) ? $headers['Content-Length'][1] : $headers['Content-Length'];
// Display the File Size
$totalsize = $bytes / 1024;
clearstatcache();
}
$kbytes = $remote->rsync_progress($home_info['home_path']."/".$filename);
list($totalsize,$mbytes,$pct) = explode(";",do_progress($kbytes,$totalsize));
$totalmbytes = round($totalsize / 1024, 2);
$pct = $pct > 100 ? 100 : $pct;
echo '<div class="dragbox bloc rounded" style="background-color:#dce9f2;" >
<h4>'. get_lang("update_in_progress") ." ${mbytes}MB/${totalmbytes}MB</h4>
<div style='background-color:#dce9f2;' >
";
$bar = '';
for( $i = 1; $i <= $pct; $i++ )
{
$bar .= '<img style="width:0.92%;vertical-align:middle;" src="images/progressBar.png">';
}
echo "<center>$bar <b style='vertical-align:top;display:inline;font-size:1.2em;color:red;' >$pct%</b></center>
</div>
</div>";
if ( $remote->is_file_download_in_progress($pid) == 0 )
{
// Lock the executable when done
$remote->secure_path("chattr+i", $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name);
print_success( get_lang("finished_manual_update") );
}
else
{
echo "<p><a href=\"?m=gamemanager&amp;p=update_manual&amp;state=refresh&amp;home_id=".
$home_id."&amp;mod_id=$mod_id&amp;pid=$pid&amp;url=$url&amp;filename=$filename\">Refresh</a></p>";
$view->refresh("?m=gamemanager&amp;p=update_manual&amp;state=refresh&amp;home_id=".
$home_id."&amp;mod_id=$mod_id&amp;pid=$pid&amp;url=$url&amp;filename=$filename",5);
}
echo create_back_button($_GET['m'],"game_monitor&amp;home_id=".$home_id);
}
else
{
echo "<form action='?m=gamemanager&amp;p=update_manual' method='post'>
<table class='center'>
<input type='hidden' name='home_id' value='$home_id' />
<input type='hidden' name='mod_id' value='$mod_id' />
<input type='hidden' name='state' value='start' />
<tr><td align='right'>". get_lang("game_name") .":</td><td align='left'>$home_info[game_name]</td></tr>
<tr><td align='right'>". get_lang("dest_dir") .":</td><td align='left'>$home_info[home_path]</td></tr>
<tr><td align='right'>". get_lang("remote_server") .":</td>
<td align='left'>$home_info[remote_server_name] ($home_info[agent_ip]:$home_info[agent_port])</td></tr>
<tr><td align='right'>". get_lang("file_url") .":</td>
<td align='left'><input type='text' id='url' name='url' value='' onChange='setFilename(this.value)' size='50' /></td></tr>
<tr><td colspan='2' class='info'>". get_lang("file_url_info") ."</td></tr>
<tr><td align='right'>". get_lang("dest_filename") .":</td>
<td align='left'><input type='text' id='filename' name='filename' value='' size='50'/></td></tr>
<tr><td colspan='2' class='info'>". get_lang("dest_filename_info") ."</td></tr>
</table>
<p><input type='submit' name='update' value='". get_lang("update_server") ."' /></p>
</form>";
?>
<script type="text/javascript">
function setFilename(url)
{
filename = url.substring(url.lastIndexOf('/')+1);
document.getElementById('filename').setAttribute('value', filename);
}
</script>
<?php
}
return;
}
?>

View file

@ -57,7 +57,6 @@ function exec_ogp_module()
"steam_guard" => $_REQUEST['steam_guard'],
"editable_email" => $_REQUEST['editable_email'],
"old_dashboard_behavior" => $_REQUEST['old_dashboard_behavior'],
"rsync_available" => $_REQUEST['rsync_available'],
"support_widget_title" => $_REQUEST['support_widget_title'],
"support_widget_content" => $_REQUEST['support_widget_content'],
"support_widget_link" => $_REQUEST['support_widget_link'],
@ -117,8 +116,6 @@ function exec_ogp_module()
$zones["$tz"] = $tz . '[' . $abbr . ' ' . formatOffset($offset) . ']';
}
$rsync_options = array("1" => get_lang('all_available_servers'), "2" => get_lang('only_remote_servers'), "3" => get_lang('only_local_servers'));
$row = $db->getSettings();
echo "<h2>".get_lang('settings')."</h2>";
@ -168,8 +165,6 @@ function exec_ogp_module()
$mail_setting = isset($row['editable_email']) ? $row['editable_email'] : "1";
$ft->add_field('on_off','editable_email',$mail_setting);
$ft->add_field('on_off','old_dashboard_behavior',@$row['old_dashboard_behavior']);
$ft->add_custom_field('rsync_available',
create_drop_box_from_array($rsync_options,"rsync_available",@$row['rsync_available'],false));
$ft->add_field('string','support_widget_title',@$row['support_widget_title']);
$ft->add_field('text','support_widget_content',@$row['support_widget_content'], 38);
$ft->add_field('string','support_widget_link',@$row['support_widget_link']);

View file

@ -1227,134 +1227,6 @@ function api_gamemanager()
}
}
if($_POST['type'] == "rsync")
{
if(isset($server_xml->lgsl_query_name))
{
$rs_name = $server_xml->lgsl_query_name;
if($rs_name == "quake3" and $server_xml->game_name == "Quake 3")
$rs_name = "q3";
}
elseif(isset($server_xml->gameq_query_name))
{
$rs_name = $server_xml->gameq_query_name;
if($rs_name == "minecraft")
{
if($server_xml->game_name == "Minecraft Tekkit")
$rs_name = "tekkit";
elseif($server_xml->game_name == "Minecraft Bukkit")
$rs_name = "bukkit";
}
}
elseif(isset($server_xml->protocol))
$rs_name = $server_xml->protocol;
else
$rs_name = $server_xml->mods->mod['key'];
$rsync_available = isset($settings['rsync_available']) ? $settings['rsync_available'] : "1";
$remote_sites = MODULES."gamemanager/rsync_sites.list";
$local_sites = MODULES."gamemanager/rsync_sites_local.list";
$rsync_sites = array();
switch ($rsync_available) {
case "0":
if(file_exists($remote_sites))
{
$sites = file($remote_sites);
if($sites !== FALSE)
$rsync_sites = array_merge($rsync_sites, $sites);
}
if(file_exists($local_sites))
{
$sites = file($local_sites);
if($sites !== FALSE)
$rsync_sites = array_merge($rsync_sites, $sites);
}
break;
case "1":
if(file_exists($remote_sites))
{
$sites = file($remote_sites);
if($sites !== FALSE)
$rsync_sites = array_merge($rsync_sites, $sites);
}
break;
case "2":
if(file_exists($local_sites))
{
$sites = file($local_sites);
if($sites !== FALSE)
$rsync_sites = array_merge($rsync_sites, $sites);
}
break;
}
if(empty($rsync_sites))
return array("status" => '336', "message" => "No sync sites found, check the panel settings (Available rsync sites).");
$url = get_faster_rsync($rsync_sites);
$sync_list_file = MODULES."gamemanager/rsync.list";
if(!file_exists($sync_list_file))
return array("status" => '336', "message" => "The sync list file doesn't exists ($sync_list_file).");
$sync_list = file($sync_list_file, FILE_IGNORE_NEW_LINES);
if(!$sync_list or empty($sync_list))
return array("status" => '337', "message" => "Failed to read sync list file ($sync_list_file).");
if(in_array($rs_name, $sync_list))
{
$exec_folder_path = clean_path($home_info['home_path'] . "/" . $server_xml->exe_location);
$exec_path = clean_path($exec_folder_path . "/" . $server_xml->server_exec_name);
preg_match("/(win|linux)(32|64)?$/", $server_xml->game_key, $matches);
$os = strtolower($matches[1]) == 'linux'? 'linux':'windows';
$full_url = "$url/ogp_game_installer/$rs_name/$os/";
$preInstallCMD = "";
if(isset($server_xml->post_install))
$preInstallCMD .= $server_xml->pre_install;
$postInstallCMD = "";
if(isset($server_xml->post_install))
$postInstallCMD .= $server_xml->post_install;
$postInstallCMD .= "\n{OGP_LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name;
$remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$preInstallCMD,$postInstallCMD);
$status = "200";
$message = "Rsync installation started";
}
else
{
$status = "335";
$message = 'This game is not supported by Rsync installation.';
}
}
if($_POST['type'] == "manual")
{
$manual_url = trim($_POST['manual_url']);
$filename = get_download_filename($manual_url);
if($filename)
{
$postInstallCMD = "";
if(isset($server_xml->post_install))
$postInstallCMD .= $server_xml->post_install;
$postInstallCMD .= "\n{OGP_LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name;
$remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress",$postInstallCMD);
$status = "200";
$message = "Manual installation started";
}
else
{
$status = "335";
$message = 'The URL for manual installation is empty or invalid.';
}
}
if($_POST['type'] == "master")
{
$ms_home_id = $db->getMasterServer($home_info['remote_server_id'], $home_info['home_cfg_id']);