#288: masterupdate reboot.php -> startupdates.php

This commit is contained in:
Ulrich Block 2014-01-26 10:42:53 +01:00
parent f501bd8188
commit b4ec3066bd
2 changed files with 16 additions and 48 deletions

View File

@ -499,49 +499,6 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
}
}
}
echo "Executing Updates if neccessary\r\n";
$query2 = $sql->prepare("SELECT `id`,`updates` FROM `rserverdata` WHERE `resellerid`=? AND (`updateMinute`=0 OR `updateMinute` IS NULL)");
$query2->execute(array($resellerid));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$rootServer = new masterServer($row2['id'], $aeskey);
if ($row2['updates'] == 3) {
echo "Updates deactivated for: " . $rootServer->sship . "\r\n";
} else {
$rootServer->collectData();
$sshcmd = (4 == $stunde) ? $rootServer->returnCmds('update', 'all') : $rootServer->returnCmds();
if ($rootServer->sshcmd !== null) {
if (ssh2_execute('gs', $row2['id'], $rootServer->sshcmd) !== false) {
$rootServer->setUpdating();
echo "Updater started for " . $rootServer->sship . "\r\n";
} else {
echo "Updating failed for: " . $rootServer->sship . "\r\n";
}
if (isset($dbConnect['debug']) and $dbConnect['debug'] == 1) {
print_r($rootServer->sshcmd);
}
} else {
echo "No updates to be executed for " . $rootServer->sship . "\r\n";
}
$rootServer = null;;
}
}
}
$newsInclude = true;

View File

@ -96,23 +96,34 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
if ($rootServer->sshcmd !== null) {
$update = ssh2_execute('gs', $row['id'], $rootServer->sshcmd);
$sshcmd = (4 == $currentHour) ? $rootServer->returnCmds('update', 'all') : $rootServer->returnCmds();
if ($update !== false) {
if ($rootServer->sshcmd !== null) {
$rootServer->setUpdating();
if (ssh2_execute('gs', $row['id'], $rootServer->sshcmd) !== false) {
echo "Updater started for " . $rootServer->sship . "\r\n";
$rootServer->setUpdating();
echo "Updater started for " . $rootServer->sship . "\r\n";
} else {
echo "Updating failed for: " . $rootServer->sship . "\r\n";
}
if (isset($dbConnect['debug']) and $dbConnect['debug'] == 1) {
print_r($rootServer->sshcmd);
}
} else {
echo "Updating failed for: " . $rootServer->sship . "\r\n";
echo "No updates to be executed for " . $rootServer->sship . "\r\n";
}
} else {
echo "No updates to be executed for " . $rootServer->sship . "\r\n";
}
$query2->execute(array($currentHour, $row['id']));