$ts3MasterVersion32 = getTS3Version('server', 'linux', 32); if (isset($ts3MasterVersion32['version']) and preg_match('/^([\\d]{1,2}.)*[\\d]{1,2}$/', $ts3MasterVersion32['version'])) { $query->execute(array($ts3MasterVersion32['version'], '32')); } $ts3MasterVersion64 = getTS3Version('server', 'linux', 64); if (isset($ts3MasterVersion64['version']) and preg_match('/^([\\d]{1,2}.)*[\\d]{1,2}$/', $ts3MasterVersion64['version'])) { $query->execute(array($ts3MasterVersion64['version'], '64')); } echo "Current versions for Teamspeak 3 Server are {$ts3MasterVersion32['version']} (32bit) and {$ts3MasterVersion64['version']} (64bit)\r\n"; echo "Fetch version for Minecraft and Bukkit Server\r\n"; $query = $sql->prepare("SELECT t.`shorten` FROM `servertypes` t LEFT JOIN `rservermasterg` r ON t.`id`=r.`servertypeid` WHERE r.`id` IS NOT NULL AND t.`gameq`='minecraft' GROUP BY t.`shorten` ORDER BY t.`shorten`"); $query2 = $sql->prepare("UPDATE `servertypes` SET `steamVersion`=?,`downloadPath`=? WHERE `shorten`=?"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { echo 'Retrieving Version for ' . $row['shorten'] . "\r\n"; $reply = $row['shorten'] == 'bukkit' ? getCraftBukkitVersion() : getMinecraftVersion(); if (is_array($reply)) { echo 'Version for ' . $row['shorten'] . ' is: ' . $reply['version'] . "\r\n"; if (strlen($reply['version']) > 1) { $query2->execute(array($reply['version'], $reply['downloadPath'], $row['shorten'])); } } } echo "Fetch version for valves appIDs\r\n"; $steamVersion = array(); $query2 = $sql->prepare("UPDATE `servertypes` SET `steamVersion`=? WHERE `appID`=?"); $query = $sql->prepare("SELECT t.`appID`,t.`shorten` FROM `servertypes` t INNER JOIN `rservermasterg` r ON t.`id`=r.`servertypeid` WHERE t.`appID` IS NOT NULL AND t.`steamgame`!='N' GROUP BY t.`appID` ORDER BY t.`appID`"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { if (!in_array($row['appID'], array(null, '', false))) { $lookUpAppID = workAroundForValveChaos($row['appID'], $row['shorten']);
private function linuxCollectData($row, $force, $returnSuccessInAnyCase) { $absoluteGamePath = $this->masterserverDir . $row['shorten']; $updateLog = '/home/' . $this->sshuser . '/logs/update-' . $row['shorten'] . '.log'; // Ensure we are in the home folder $this->shellScript .= 'cd /home/' . $this->sshuser . "\n"; if ($row['supdates'] != 3 and $row['updates'] != 3) { // Create masterserver folder if it does not exists $this->shellScript .= 'if [ ! -d "' . $absoluteGamePath . '" ]; then mkdir -p "' . $absoluteGamePath . '"; fi' . "\n"; // If template and app master configs allow sync if (in_array($row['supdates'], array(1, 4)) and in_array($row['updates'], array(1, 4))) { $this->serverSync($row['shorten'], $updateLog); } // If template and app master configs allow vendor update if (in_array($row['supdates'], array(1, 2)) and in_array($row['updates'], array(1, 2))) { //Steam updater if ($row['steamgame'] == 'S') { $this->shellScript .= 'cd /home/' . $this->sshuser . '/masterserver/steamCMD/' . "\n"; $this->shellScript .= 'taskset -c 0 ${IONICE}nice -n +19 ./steamcmd.sh +login '; if (strlen($this->steamAccount) > 0) { $this->shellScript .= $this->steamAccount . ' ' . $this->steamPassword; } else { if (strlen($row['steamAcc']) > 0) { $this->shellScript .= $row['steamAcc'] . ' ' . $row['steamPwd']; } else { $this->shellScript .= 'anonymous'; } } $this->shellScript .= ' +force_install_dir ' . $absoluteGamePath . ' '; $fixedId = workAroundForValveChaos($row['appID'], $row['shorten'], false); $this->shellScript .= $fixedId == 90 ? '+app_set_config 90 mod ' . $row['shorten'] . ' +app_update 90' : '+app_update ' . $fixedId; $this->shellScript .= ' validate +quit > ' . $updateLog . "\n"; } else { if ($row['steamgame'] == 'N' and $row['shorten'] == 'mc') { if (!isurl($row['downloadPath'])) { if (!function_exists('getMinecraftVersion')) { require_once EASYWIDIR . '/stuff/methods/queries_updates.php'; } $mcVersion = getMinecraftVersion(); if (isset($mcVersion['downloadPath']) and isurl($mcVersion['downloadPath'])) { $row['downloadPath'] = $mcVersion['downloadPath']; } } if (isurl($row['downloadPath'])) { $this->shellScript .= 'cd ' . $absoluteGamePath . "\n"; $this->shellScript .= 'wget -q ' . $row['downloadPath'] . ' --output-document ' . $row['gamebinary'] . '.new' . "\n"; $this->shellScript .= 'if [ `stat -c %s ' . $row['gamebinary'] . '.new` -gt 0 ]; then' . "\n"; $this->shellScript .= 'mv ' . $row['gamebinary'] . '.new ' . $row['gamebinary'] . "\n"; $this->shellScript .= 'else' . "\n"; $this->shellScript .= 'rm -f ' . $row['gamebinary'] . '.new ' . "\n"; $this->shellScript .= 'fi' . "\n"; $this->shellScript .= 'chmod 750 ' . $row['gamebinary'] . "\n"; } } } } // Housekeeping $this->houseKeeping($absoluteGamePath); $this->createFdlList($row); $this->sendUpdateSuccess($updateLog, $force, $row, $returnSuccessInAnyCase); $this->removeLogs[] = $updateLog; $this->updateAmount++; } }