|
@@ -51,6 +51,8 @@ class SelfUpdateCommand extends BaseCommand
|
|
|
new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
|
|
|
new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
|
|
|
new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
|
|
|
+ new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
|
|
|
+ new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
|
|
|
new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
|
|
|
))
|
|
|
->setHelp(
|
|
@@ -82,9 +84,10 @@ EOT
|
|
|
$versionsUtil = new Versions($config, $remoteFilesystem);
|
|
|
|
|
|
// switch channel if requested
|
|
|
- foreach (array('stable', 'preview', 'snapshot') as $channel) {
|
|
|
+ foreach (Versions::CHANNELS as $channel) {
|
|
|
if ($input->getOption($channel)) {
|
|
|
$versionsUtil->setChannel($channel);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -123,9 +126,14 @@ EOT
|
|
|
}
|
|
|
|
|
|
$latest = $versionsUtil->getLatest();
|
|
|
+ $latestStable = $versionsUtil->getLatest('stable');
|
|
|
$latestVersion = $latest['version'];
|
|
|
$updateVersion = $input->getArgument('version') ?: $latestVersion;
|
|
|
|
|
|
+ if (is_numeric($channel) && substr($latestStable['version'], 0, 1) !== $channel) {
|
|
|
+ $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$channel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
|
|
|
+ }
|
|
|
+
|
|
|
if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
|
|
|
$io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
|
|
|
|