} else {
        $orderBy = '`id` ASC';
    }
}
$query2 = $sql->prepare("SELECT s.`shorten`,r.`installing`,r.`updating`,r.`installstarted` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND r.`resellerid`=? GROUP BY s.`shorten`");
$query3 = $sql->prepare("SELECT r.`id`,s.`steamgame`,s.`updates`,d.`updates` AS `rupdates` FROM `rservermasterg` r INNER JOIN `rserverdata` d ON r.`serverid`=d.`id` INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE s.`shorten`=? AND r.`resellerid`=? AND d.`ip`=? LIMIT 1");
$query4 = $sql->prepare("UPDATE `rservermasterg` SET `installing`='N',`updating`='N' WHERE `id`=? LIMIT 1");
if ($sSearch) {
    $query = $sql->prepare("SELECT `id`,`ip`,`description` FROM `rserverdata` AS r WHERE `active`='Y' AND `resellerid`=:resellerID AND (`id` LIKE :search OR `ip` LIKE :search OR `description` LIKE :search OR EXISTS (SELECT 1 FROM `rservermasterg` AS m INNER JOIN `servertypes` s ON s.`id`=m.`servertypeid` WHERE m.`serverid`=r.`id` AND s.`shorten` LIKE :search)) ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
    $query->execute(array(':resellerID' => $resellerLockupID, ':search' => '%' . $sSearch . '%'));
} else {
    $query = $sql->prepare("SELECT `id`,`ip`,`description` FROM `rserverdata` WHERE `active`='Y' AND `resellerid`=? ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
    $query->execute(array($resellerLockupID));
}
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
    $rootServer = new masterServer($row['id'], $aeskey);
    $statusList = array();
    $sshcheck = array();
    $description = $row['description'];
    $query2->execute(array($row['id'], $resellerLockupID));
    while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
        $shorten = $row2['shorten'];
        if ($row2['installing'] == 'N' and $row2['updating'] == 'N') {
            $statusList[$row2['shorten']] = true;
        } else {
            $toolong = date($row2['installstarted'], strtotime("+15 minutes"));
            if (strtotime($logdate) > strtotime($toolong)) {
                $sshcheck[] = $row2['shorten'];
                $rootServer->checkForUpdate($row2['shorten']);
            } else {
                $statusList[$row2['shorten']] = false;
예제 #2
0
 echo "Start Syncs and Updates. Hour is {$currentHour} and minute is {$currentMinute}\r\n";
 $query = $sql->prepare("SELECT `lastUpdateRun` FROM `settings` WHERE `resellerid`=0 LIMIT 1");
 $query->execute();
 $lastUpdateRun = (int) $query->fetchColumn();
 $query = $sql->prepare("UPDATE `settings` SET `lastUpdateRun`=? WHERE `resellerid`=0 LIMIT 1");
 $query->execute(array($currentMinute));
 echo "Checking for servers to be updated and or synced at hour {$currentHour} and between minutes {$lastUpdateRun} and {$currentMinute}\r\n";
 // avoid less/more OR equal in SQL. We want only less/more to eliminate the OR comparison
 $currentMinute++;
 $lastUpdateRun--;
 echo "Altered minutes for running a more efficient query will be  updateMinute > {$lastUpdateRun} AND updateMinute < {$currentMinute}\r\n";
 $query = $sql->prepare("SELECT `id`,`updates` FROM `rserverdata` WHERE (`alreadyStartedAt` IS NULL OR `alreadyStartedAt`!=?) AND `updateMinute`>? AND `updateMinute`<?");
 $query2 = $sql->prepare("UPDATE `rserverdata` SET `alreadyStartedAt`=? WHERE `id`=? LIMIT 1");
 $query->execute(array($currentHour, $lastUpdateRun, $currentMinute));
 while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
     $rootServer = new masterServer($row['id'], $aeskey);
     if ($row['updates'] == 3) {
         echo "Updates deactivated for: " . $rootServer->sship . "\r\n";
     } else {
         if (4 == $currentHour) {
             $rootServer->collectData(true, true, false);
         } else {
             $rootServer->collectData();
         }
         $sshReturn = $rootServer->sshConnectAndExecute();
         if ($sshReturn === false and $rootServer->updateAmount > 0) {
             echo "Updating failed for: " . $rootServer->sship . "\r\n";
         } else {
             if ($rootServer->updateAmount > 0) {
                 echo "Updater started for " . $rootServer->sship . "\r\n";
                 if (isset($dbConnect['debug']) and $dbConnect['debug'] == 1) {
예제 #3
0
 * OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
 * Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
 * Siehe die GNU General Public License fuer weitere Details.
 *
 * Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
 * Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
 */
if (!defined('AJAXINCLUDED')) {
    die('Do not access directly!');
}
include EASYWIDIR . '/stuff/methods/functions_ssh_exec.php';
include EASYWIDIR . '/stuff/methods/class_masterserver.php';
include EASYWIDIR . '/stuff/keyphrasefile.php';
$gamelist = array();
$sprache = getlanguagefile('roots', $user_language, $resellerLockupID);
$rootServer = new masterServer($ui->id('serverID', 10, 'get'), $aeskey);
$query = $sql->prepare("SELECT `shorten` FROM `servertypes` WHERE `id`=? AND `resellerid`=? LIMIT 1");
foreach ($ui->id('masterIDs', 10, 'get') as $masterID) {
    $query->execute(array($masterID, $resellerLockupID));
    $gameShorten = $query->fetchColumn();
    if (strlen($gameShorten) > 0) {
        $gamelist[] = $gameShorten;
        $rootServer->collectData($masterID, true);
    }
}
$return = $rootServer->sshConnectAndExecute();
if (count($gamelist) == 0) {
    echo 'Nothing to update/sync!';
} else {
    if ($return === false) {
        echo $sprache->error_root_updatemaster . ' ( ' . implode(', ', $gamelist) . ' )';
예제 #4
0
         }
         if (isset($ip) and isset($os)) {
             $query = $sql->prepare("SELECT `id`,`shorten`,`steamgame`,`description` FROM `servertypes` AS t WHERE `resellerid`=? AND (`os`='B' OR `os`=?) AND NOT EXISTS (SELECT 1 FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND s.`shorten`=t.`shorten`) ORDER BY `description`");
             $query->execute(array($resellerLockupID, $os, $id));
             while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                 $table[] = array('id' => $row['id'], 'shorten' => $row['shorten'], 'description' => $row['description']);
             }
             $template_file = 'admin_master_add.tpl';
         } else {
             $template_file = 'admin_404.tpl';
         }
     }
 } else {
     if ($ui->st('d', 'get') == 'dl' and $ui->id('id', 10, 'get')) {
         if ($ui->smallletters('action', 2, 'post') == 'dl') {
             $rootServer = new masterServer($ui->id('id', 10, 'get'), $aeskey);
             if ($ui->id('id', 10, 'post')) {
                 $template_file = '';
                 $query = $sql->prepare("SELECT s.`shorten` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`id`=? AND r.`resellerid`=? LIMIT 1");
                 $query2 = $sql->prepare("DELETE FROM `rservermasterg` WHERE `id`=? AND `resellerid`=? LIMIT 1");
                 foreach ($ui->id('id', 10, 'post') as $id) {
                     $query->execute(array($id, $resellerLockupID));
                     $shorten = $query->fetchColumn();
                     $rootServer->masterRemove($shorten);
                     $query2->execute(array($id, $resellerLockupID));
                     $template_file .= $spracheResponse->table_del . ': ' . $shorten . '<br />';
                     $loguseraction = '%del% %master% ' . $rootServer->sship . ' ' . $shorten;
                     $insertlog->execute();
                 }
                 $rootServer->sshConnectAndExecute(false);
                 $template_file .= $sprache->root_masterdel;