Merge remote-tracking branch 'bamarni/require-command-rollback'
commit
8ab5ef430a
|
@ -64,11 +64,17 @@ EOT
|
|||
|
||||
return 1;
|
||||
}
|
||||
if (!is_writable($file)) {
|
||||
$output->writeln('<error>'.$file.' is not writable.</error>');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
$dialog = $this->getHelperSet()->get('dialog');
|
||||
|
||||
$json = new JsonFile($file);
|
||||
$composer = $json->read();
|
||||
$composerBackup = file_get_contents($json->getPath());
|
||||
|
||||
$requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'));
|
||||
|
||||
|
@ -106,7 +112,12 @@ EOT
|
|||
->setUpdateWhitelist($requirements);
|
||||
;
|
||||
|
||||
return $install->run() ? 0 : 1;
|
||||
if (!$install->run()) {
|
||||
$output->writeln("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
|
||||
file_put_contents($json->getPath(), $composerBackup);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private function updateFileCleanly($json, array $base, array $new, $requireKey)
|
||||
|
|
Loading…
Reference in New Issue