Skip to content

Commit

Permalink
Merge branch 'master' of github.com:VisualAppeal/PHP-Auto-Update
Browse files Browse the repository at this point in the history
  • Loading branch information
thelfensdrfer committed Jun 14, 2017
2 parents 83721b7 + eb030bb commit e1b0a4b
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/AutoUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ public function checkUpdate()
$this->_log->addDebug(sprintf('Get new updates from %s', $updateFile));

// Read update file from update server
$update = @file_get_contents($updateFile, $this->_useBasicAuth());
$update = @file_get_contents($updateFile, false, $this->_useBasicAuth());
if ($update === false) {
$this->_log->addInfo(sprintf('Could not download update file "%s"!', $updateFile));

Expand Down Expand Up @@ -552,7 +552,7 @@ public function newVersionAvailable()
protected function _downloadUpdate($updateUrl, $updateFile)
{
$this->_log->addInfo(sprintf('Downloading update "%s" to "%s"', $updateUrl, $updateFile));
$update = @file_get_contents($updateUrl, $this->_useBasicAuth());
$update = @file_get_contents($updateUrl, false, $this->_useBasicAuth());

if ($update === false) {
$this->_log->addError(sprintf('Could not download update "%s"!', $updateUrl));
Expand Down Expand Up @@ -759,7 +759,7 @@ protected function _install($updateFile, $simulateInstall, $version)
} else {
// touch will fail if PHP is not the owner of the file, and file_put_contents is faster than touch.
if (file_put_contents($absoluteFilename, '') === false) {
$this->_log->addError(sprintf('[SIMULATE] The file "%s" could not be created!', $absoluteFilename));
$this->_log->addError(sprintf('The file "%s" could not be created!', $absoluteFilename));
zip_close($zip);

return false;
Expand All @@ -778,21 +778,10 @@ protected function _install($updateFile, $simulateInstall, $version)
}


if (!fwrite($updateHandle, $contents)) {
if (zip_entry_filesize($file) == 0) {
if (!file_put_contents($absoluteFilename , chr(0) )) {

$this->_log->addError(sprintf('Could not write to file "%s"!', $absoluteFilename));
zip_close($zip);
return false;
}
}
else
{
$this->_log->addError(sprintf('Could not write to file "%s"!', $absoluteFilename));
zip_close($zip);
return false;
}
if (false === fwrite($updateHandle, $contents)) {
$this->_log->addError(sprintf('Could not write to file "%s"!', $absoluteFilename));
zip_close($zip);
return false;
}

fclose($updateHandle);
Expand Down

0 comments on commit e1b0a4b

Please sign in to comment.