diff --git a/includes/api_functions.php b/includes/api_functions.php index 7c04ab63..43ad0c44 100644 --- a/includes/api_functions.php +++ b/includes/api_functions.php @@ -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)) diff --git a/includes/html_functions.php b/includes/html_functions.php index f4caaa21..0347178c 100644 --- a/includes/html_functions.php +++ b/includes/html_functions.php @@ -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 = "\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) { diff --git a/includes/lib_remote.php b/includes/lib_remote.php index 111dcbf6..3b154c5b 100644 --- a/includes/lib_remote.php +++ b/includes/lib_remote.php @@ -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. diff --git a/lang/English/modules/gamemanager.php b/lang/English/modules/gamemanager.php index 3b66f4c5..86c39470 100644 --- a/lang/English/modules/gamemanager.php +++ b/lang/English/modules/gamemanager.php @@ -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"); -?> diff --git a/lang/English/modules/settings.php b/lang/English/modules/settings.php index 0b7a61b3..2edbc2e6 100644 --- a/lang/English/modules/settings.php +++ b/lang/English/modules/settings.php @@ -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"); diff --git a/modules/billing/create_servers.php b/modules/billing/create_servers.php index 0840990c..0c560fa5 100644 --- a/modules/billing/create_servers.php +++ b/modules/billing/create_servers.php @@ -229,66 +229,41 @@ 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)) + $remote->exec((string)$precmd); + if (!empty((string)$postcmd)) + $remote->exec((string)$postcmd); } echo "


".get_lang('starting_installations')."


"; //PANEL LOG diff --git a/modules/gamemanager/monitor_buttons.php b/modules/gamemanager/monitor_buttons.php index 14864194..27daddab 100644 --- a/modules/gamemanager/monitor_buttons.php +++ b/modules/gamemanager/monitor_buttons.php @@ -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[] = " - - ". get_lang("update_from_local_master_server") ." - "; - } - - //$module_buttons[] = " - $module_buttons[] = " - - ". get_lang("install_update_steam") ." - - "; - - $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[] = " - - ". get_lang("install_update_manual") ." + $module_buttons[] = " + + ". get_lang("update_from_local_master_server") ." "; } - // 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[] = " - - ". get_lang("rsync_install") ." - "; - } - } + // Update button — runs SteamCMD (validate) for steam games, or install scripts for others. + $module_buttons[] = " + + ". get_lang("update_server") ." + "; + $hasSteamAutoUpdate = true; /* $module_buttons[] = " diff --git a/modules/gamemanager/navigation.xml b/modules/gamemanager/navigation.xml index ef0f39d0..96d35f29 100644 --- a/modules/gamemanager/navigation.xml +++ b/modules/gamemanager/navigation.xml @@ -4,8 +4,7 @@ - - + diff --git a/modules/gamemanager/rsync.list b/modules/gamemanager/rsync.list deleted file mode 100644 index 15121cc5..00000000 --- a/modules/gamemanager/rsync.list +++ /dev/null @@ -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 diff --git a/modules/gamemanager/rsync_install.php b/modules/gamemanager/rsync_install.php deleted file mode 100644 index f27cf90f..00000000 --- a/modules/gamemanager/rsync_install.php +++ /dev/null @@ -1,417 +0,0 @@ - $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
"; - return 0; - } - echo "Updating local cache of rsync meta data files
"; - $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
"; - foreach ((array)$update_urls as $site) - { - #echo "Trying $file_chk from $site
"; - 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
";}; - 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 "

Update $home_info[home_name]

"; - - 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 = "&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 "

". - get_lang("refresh_rsync_status") ."

"; - $view->refresh("?m=gamemanager&p=rsync_install&update=refresh&home_id=$home_id&mod_id=$mod_id$master",5); - return; - } - elseif( $rsync === 0 ) - { - print_failure( get_lang("agent_offline") ); - return; - } - } - elseif($update_active == 1) - { - echo "

\n"; - if ( isset( $_POST['stop_update_x'] ) ) - { - $remote->stop_update($home_id); - print_success("Update stopped."); - $view->refresh("?m=gamemanager&p=rsync_install&update=refresh&home_id=$home_id&mod_id=$mod_id", 2); - return; - } - $update_complete = false; - echo "
". get_lang("stop_update") ."
"; - 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 '
-

'. get_lang("update_in_progress") ." ${mbytes}MB/${totalmbytes}MB

-
- "; - $bar = ''; - for( $i = 1; $i <= $pct; $i++ ) - { - $bar .= ''; - } - echo "$bar $pct% -
-

"; - } - else - { - echo '

'. get_lang("update_in_progress") .'

'; - } - - echo "
".$log_txt."
\n". - "

". - get_lang("refresh_rsync_status") ."

"; - $view->refresh("?m=gamemanager&p=rsync_install&update=refresh&home_id=$home_id&mod_id=$mod_id",5); - return; - - } - elseif($update != "update") - { - $view->refresh("{CURRENT_PAGE}", 60); - print_success(get_lang("update_completed") ); - echo "
<< ". get_lang("back") ."
"; - echo "
".$log_txt."
\n"; - echo "
<< ". get_lang("back") ."
"; - $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
". - "Make sure allow_fopen_url is set to \"On\" in your php.ini and opengamepanel.org is online
". - "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 "
- - - - - - - - - - -
Game name:$home_info[game_name]
Directory:$home_info[home_path]
Remoteserver:$home_info[remote_server_name] ($home_info[agent_ip]:$home_info[agent_port])
Rsync Server:".create_drop_box_from_array_rsync($rsync_sites,"url_id")."
"; - if( $master_server_home_id != FALSE AND $master_server_home_id != $home_id ) - { - echo "". get_lang("update_from_local_master_server") .""; - } - echo "

-
"; - } - elseif($master_server_home_id != FALSE AND $master_server_home_id != $home_id) - { - $ms_home_info = $db->getGameHome($master_server_home_id); - echo "
-

Master server update available


-
- - - - - - - - - ". - "". - "
Game name:$home_info[game_name]
Master Server Name:$ms_home_info[home_name]
Master Server Directory:$ms_home_info[home_path]
Local Directory:$home_info[home_path]

-
"; - } - else - { - print_failure("This game type [ $lgslname ] is not yet supported with rsync install"); - } - } -} -?> diff --git a/modules/gamemanager/rsync_sites.list b/modules/gamemanager/rsync_sites.list deleted file mode 100644 index 3f1e9537..00000000 --- a/modules/gamemanager/rsync_sites.list +++ /dev/null @@ -1,2 +0,0 @@ -files.iareserver.com|Kansas City USA - diff --git a/modules/gamemanager/rsync_sites_local.list b/modules/gamemanager/rsync_sites_local.list deleted file mode 100644 index 0b946abf..00000000 --- a/modules/gamemanager/rsync_sites_local.list +++ /dev/null @@ -1 +0,0 @@ -files.iareserver.com|Kansas City USA diff --git a/modules/gamemanager/sizes.list b/modules/gamemanager/sizes.list deleted file mode 100644 index 18546eb7..00000000 --- a/modules/gamemanager/sizes.list +++ /dev/null @@ -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 diff --git a/modules/gamemanager/update_server.php b/modules/gamemanager/update_server.php index af2d4fdb..9364e971 100644 --- a/modules/gamemanager/update_server.php +++ b/modules/gamemanager/update_server.php @@ -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,17 @@ 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. + if (!empty((string)$precmd)) + $remote->exec((string)$precmd); + if (!empty((string)$postcmd)) + $remote->exec((string)$postcmd); + print_success( get_lang("update_started") ); + $view->refresh("?m=gamemanager&p=game_monitor&home_id=$home_id", 3); + return; + } if( $steam_out === 0 ) { diff --git a/modules/gamemanager/update_server_manual.php b/modules/gamemanager/update_server_manual.php deleted file mode 100644 index 046d1045..00000000 --- a/modules/gamemanager/update_server_manual.php +++ /dev/null @@ -1,168 +0,0 @@ - 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 "

". get_lang("install_update_manual") ." $home_info[home_name]

"; - - 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 '
-

'. get_lang("update_in_progress") ." ${mbytes}MB/${totalmbytes}MB

-
- "; - $bar = ''; - for( $i = 1; $i <= $pct; $i++ ) - { - $bar .= ''; - } - echo "
$bar $pct%
-
-
"; - - 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 "

Refresh

"; - $view->refresh("?m=gamemanager&p=update_manual&state=refresh&home_id=". - $home_id."&mod_id=$mod_id&pid=$pid&url=$url&filename=$filename",5); - } - echo create_back_button($_GET['m'],"game_monitor&home_id=".$home_id); - } - else - { - echo "
- - - - - - - - - - - - - - -
". get_lang("game_name") .":$home_info[game_name]
". get_lang("dest_dir") .":$home_info[home_path]
". get_lang("remote_server") .":$home_info[remote_server_name] ($home_info[agent_ip]:$home_info[agent_port])
". get_lang("file_url") .":
". get_lang("file_url_info") ."
". get_lang("dest_filename") .":
". get_lang("dest_filename_info") ."
-

-
"; - ?> - - diff --git a/modules/settings/settings.php b/modules/settings/settings.php index a495ca7d..e69798b0 100644 --- a/modules/settings/settings.php +++ b/modules/settings/settings.php @@ -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 "

".get_lang('settings')."

"; @@ -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']); diff --git a/ogp_api.php b/ogp_api.php index 625349a1..90fae2da 100644 --- a/ogp_api.php +++ b/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']);