feat: remove legacy rsync/manual install methods, standardize SteamCMD pipeline, fix Update button
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/9c87b62e-17b2-4f36-9b49-82238d73dda2 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
43877bbd9e
commit
75e63475ae
17 changed files with 56 additions and 1000 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue