Merge pull request #5021 from vlakoff/self-update
Adjustments in self-update command in case of corrupted filepull/5025/head
commit
fe134d3359
|
@ -203,6 +203,7 @@ TAGSPUBKEY
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
|
if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
|
||||||
|
@unlink($tempFilename);
|
||||||
$io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
|
$io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
|
||||||
$io->writeError('<error>Please re-run the self-update command to try again.</error>');
|
$io->writeError('<error>Please re-run the self-update command to try again.</error>');
|
||||||
|
|
||||||
|
@ -281,7 +282,7 @@ TAGSPUBKEY
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
$io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
|
$io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
|
||||||
if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
|
if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
|
||||||
$io->writeError('<error>The backup file was corrupted ('.$err->getMessage().') and has been removed.</error>');
|
$io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -312,9 +313,6 @@ TAGSPUBKEY
|
||||||
|
|
||||||
rename($newFilename, $localFilename);
|
rename($newFilename, $localFilename);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if ($backupTarget) {
|
|
||||||
@unlink($newFilename);
|
|
||||||
}
|
|
||||||
if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
|
if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue