$flag = 1; if (file_exists(GAME_ROOT . './gamedata/tmp/server/' . $sid . '/busy')) { continue; } $chosen = $sid; break; } } if (!$flag) { __SOCKET_ERRORLOG__("未找到在线的服务器。"); } if ($chosen == -1) { $z = rand(0, count($srvlist) - 1); $chosen = $srvlist[$z]; touch(GAME_ROOT . './gamedata/tmp/server/request_new_server'); __SOCKET_LOG__("没有服务器空闲,已请求脚本启动新服务器。"); } __SOCKET_DEBUGLOG__("选择了端口号为 " . $chosen . '的服务器 。'); $___TEMP_CONN_PORT = $chosen; } else { __SOCKET_ERRORLOG__('无法打开gamedata/tmp/server目录。'); } __SOCKET_SEND_TO_SERVER__(); __SOCKET_DEBUGLOG__('Client执行完成。'); die; } else { //否则是由server自行引用的command.php,开始执行 $pagestartime = microtime(true); } } } else {
flush(); } } } } echo '<font color="blue">代码预处理CODE_ADV3完成。</font><br><br>'; $str = '___temp_s = new String(\'' . base64_encode(gzencode(compatible_json_encode($___TEMP_codeadv3_v))) . '\'); ___datalib = JSON.parse(JXG.decompress(___temp_s)); delete ___temp_s; '; $file = 'datalib.' . uniqid('', true) . '.js'; writeover(GAME_ROOT . './gamedata/javascript/' . $file, $str); writeover(GAME_ROOT . './gamedata/javascript/datalib.current.txt', $file); } $faillog = ''; copy(GAME_ROOT . './gamedata/modules.list.pass.php', GAME_ROOT . './gamedata/modules.list.php'); unlink(GAME_ROOT . './gamedata/modules.list.pass.php'); unlink(GAME_ROOT . './gamedata/modules.list.temp.php'); if ($___MOD_SRV) { //重启daemon echo '<font color="blue">正在重启Daemon...</font> '; ob_end_flush(); flush(); require GAME_ROOT . './include/socket.func.php'; __STOP_ALL_SERVER__(); touch(GAME_ROOT . './gamedata/tmp/server/request_new_root_server'); __SOCKET_LOG__("已请求脚本启动一台新的服务器。"); echo '<font color="blue">完成。</font><br><br>'; } echo '<font color="green">操作成功完成。修改已经被应用。<br><br></font>'; echo '<a href="modulemng.php" style="text-decoration: none"><span><font color="blue">[返回首页]</font></span></a><br>';
function __STOP_ALL_SERVER__() { global $___TEMP_runmode, $___TEMP_CONN_PORT; $___TEMP_runmode = 'Admin'; $___TEMP_CONN_PORT = -1; __SOCKET_LOG__("收到命令,立即停止所有服务器。"); if ($handle = opendir(GAME_ROOT . './gamedata/tmp/server')) { while (($sid = readdir($handle)) !== false) { if ($sid == '.' || $sid == '..') { continue; } $sid = (int) $sid; if (is_dir(GAME_ROOT . './gamedata/tmp/server/' . (string) $sid)) { __SOCKET_LOG__("开始向端口号为 {$sid} 的服务器发送停止指令。"); if (!__SEND_STOP_CMD__($sid)) { __SOCKET_WARNLOG__("消息发送失败,强行删除文件夹 {$sid} 。"); clear_dir(GAME_ROOT . './gamedata/tmp/server/' . (string) $sid); } } } if (file_exists(GAME_ROOT . './gamedata/tmp/server/request_new_server')) { unlink(GAME_ROOT . './gamedata/tmp/server/request_new_server'); } if (file_exists(GAME_ROOT . './gamedata/tmp/server/request_new_root_server')) { unlink(GAME_ROOT . './gamedata/tmp/server/request_new_root_server'); } } else { __SOCKET_ERRORLOG__('无法打开gamedata/tmp/server目录。'); } }