"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/web/lib/service/fogservice.class.php" between
fogproject-1.5.7.tar.gz and fogproject-1.5.8.tar.gz

About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.

fogservice.class.php  (fogproject-1.5.7):fogservice.class.php  (fogproject-1.5.8)
skipping to change at line 133 skipping to change at line 133
_(' | This is not the master node') _(' | This is not the master node')
); );
} }
/** /**
* Wait to ensure the network interface is ready * Wait to ensure the network interface is ready
* *
* @return void * @return void
*/ */
public function waitInterfaceReady() public function waitInterfaceReady()
{ {
self::getIPAddress(); self::getIPAddress(true);
if (!count(self::$ips)) { if (!count(self::$ips) || !in_array(self::getSetting('FOG_WEB_HOST'), se
lf::$ips)) {
self::outall( self::outall(
_('Interface not ready, waiting.') sprintf(
'%s: %s',
_('Interface not ready, waiting for it to come up'),
self::getSetting('FOG_WEB_HOST')
)
); );
sleep(10); sleep(10);
$this->waitInterfaceReady(); $this->waitInterfaceReady();
} }
foreach (self::$ips as &$ip) { foreach (self::$ips as &$ip) {
self::outall( self::outall(
_("Interface Ready with IP Address: $ip") _("Interface Ready with IP Address: $ip")
); );
unset($ip); unset($ip);
} }
skipping to change at line 597 skipping to change at line 601
array_unique($remotefilescheck) array_unique($remotefilescheck)
) )
); );
foreach ($remotefilescheck as &$rfn) { foreach ($remotefilescheck as &$rfn) {
$rfn = str_replace("$remItem/", "", $rfn); $rfn = str_replace("$remItem/", "", $rfn);
unset($rfn); unset($rfn);
} }
$filescheck = array_unique(array_merge((array)$localfilescheck, (array)$remotefilescheck)); $filescheck = array_unique(array_merge((array)$localfilescheck, (array)$remotefilescheck));
$testavail = -1; $testavail = -1;
$allsynced = true; $allsynced = true;
$resp = self::$FOGURLRequests->isAvailable($testip, 1, 80);
$avail = true;
$testavail = array_filter($resp);
$testavail = array_shift($testavail);
if (!$testavail) {
$avail = false;
}
foreach ($filescheck as $j => &$filename) { foreach ($filescheck as $j => &$filename) {
$filesequal = false; $filesequal = false;
$avail = true;
$lindex = array_search($filename, $localfilescheck); $lindex = array_search($filename, $localfilescheck);
$rindex = array_search($filename, $remotefilescheck); $rindex = array_search($filename, $remotefilescheck);
$localfilename = sprintf('%s%s%s', $path, "/", $localfilesch eck[$lindex]); $localfilename = sprintf('%s%s%s', $path, "/", $localfilesch eck[$lindex]);
$remotefilename = sprintf('%s%s%s', $remItem, "/", $remotefi lescheck[$rindex]); $remotefilename = sprintf('%s%s%s', $remItem, "/", $remotefi lescheck[$rindex]);
if (!is_int($rindex)) { if (!is_int($rindex)) {
$allsynced = false; $allsynced = false;
self::outall(sprintf( self::outall(sprintf(
' # %s: %s %s (%s)', ' # %s: %s %s (%s)',
$name, $name,
_('File does not exist'), _('File does not exist'),
skipping to change at line 625 skipping to change at line 637
' # %s: %s %s %s %s %s', ' # %s: %s %s %s %s %s',
$name, $name,
_('File does not exist'), _('File does not exist'),
'on master node, deleting', 'on master node, deleting',
$filename, $filename,
'on', 'on',
$nodename $nodename
)); ));
self::$FOGFTP->delete($remotefilename); self::$FOGFTP->delete($remotefilename);
} else { } else {
$resp = self::$FOGURLRequests->isAvailable($testip, 1, 8
0);
$testavail = array_filter($resp);
$testavail = array_shift($testavail);
if (!$testavail) {
$avail = false;
}
$localsize = self::getFilesize($localfilename); $localsize = self::getFilesize($localfilename);
$remotesize = null;
if ($avail) { if ($avail) {
$remotesize = self::$FOGURLRequests->process( $rsize = self::$FOGURLRequests->process(
$sizeurl, $sizeurl,
'POST', 'POST',
['file' => base64_encode($remotefilename)] ['file' => base64_encode($remotefilename)]
); );
$remotesize = array_shift($remotesize); $rsize = array_shift($rsize);
} else { if (is_int($rsize)) {
$remotesize = $rsize;
} else {
// we should re-try HTTPS because we don't know
about the storage node setup
// and letting curl follow the redirect doesn't
work for POST requests
$sizeurl = sprintf('%s://%s/fog/status/getsize.p
hp', 'https', $testip);
$rsize = self::$FOGURLRequests->process(
$sizeurl,
'POST',
['file' => base64_encode($remotefilename)]
);
$rsize = array_shift($rsize);
if (is_int($rsize)) {
$remotesize = $rsize;
}
}
}
if (is_null($remotesize)) {
$remotesize = self::$FOGFTP->size($remotefilename); $remotesize = self::$FOGFTP->size($remotefilename);
} }
if ($localsize == $remotesize) { if ($localsize == $remotesize) {
$localhash = self::getHash($localfilename); $localhash = self::getHash($localfilename);
$remotehash = null;
if ($avail) { if ($avail) {
$remotehash = self::$FOGURLRequests->process( $rhash = self::$FOGURLRequests->process(
$hashurl, $hashurl,
'POST', 'POST',
['file' => base64_encode($remotefilename)] ['file' => base64_encode($remotefilename)]
); );
$remotehash = array_shift($remotehash); $rhash = array_shift($rhash);
} else { if (strlen($rhash) == 64) {
$remotehash = $rhash;
} else {
// we should re-try HTTPS because we don't k
now about the storage node setup
// and letting curl follow the redirect does
n't work for POST requests
$hashurl = sprintf('%s://%s/fog/status/getha
sh.php', 'https', $testip);
$rhash = self::$FOGURLRequests->process(
$hashurl,
'POST',
['file' => base64_encode($remotefilename
)]
);
$rhash = array_shift($rhash);
if (strlen($rhash) == 64) {
$remotehash = $rhash;
}
}
}
if (is_null($remotehash)) {
if ($localsize < 10485760) { if ($localsize < 10485760) {
$remotehash = hash_file('sha256', $ftpstart. $remotefilename); $remotehash = hash_file('sha256', $ftpstart. $remotefilename);
} else { } else {
$filesequal = true; $filesequal = true;
} }
} }
if ($localhash == $remotehash) { if ($localhash == $remotehash) {
$filesequal = true; $filesequal = true;
} else { } else {
self::outall(sprintf( self::outall(sprintf(
 End of changes. 11 change blocks. 
17 lines changed or deleted 66 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)