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
128
ogp_api.php
128
ogp_api.php
|
|
@ -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']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue