private function downloadNewVersion()
{
// check for permissions in local filesystem before start downloading files
if (!is_writable($this->currentInstallerFile)) {
throw new IOException('Symfony Installer update failed: the "' . $this->currentInstallerFile . '" file could not be written');
}
if (!is_writable($this->tempDir)) {
throw new IOException('Symfony Installer update failed: the "' . $this->tempDir . '" directory used to download files temporarily could not be written');
}
if (false === ($newInstaller = $this->getUrlContents($this->remoteInstallerFile))) {
throw new \RuntimeException('The new version of the Symfony Installer couldn\'t be downloaded from the server.');
}
$newInstallerPermissions = $this->currentInstallerFile ? fileperms($this->currentInstallerFile) : 0777 & ~umask();
$this->fs->dumpFile($this->newInstallerFile, $newInstaller, $newInstallerPermissions);
return $this;
}