protected function execute(InputInterface $input, OutputInterface $output) { if (PHP_VERSION_ID < 50600) { $message = 'Self updating is not available in PHP versions under 5.6.' . "\n"; $message .= 'The latest version can be found at ' . self::PHAR_URL; $output->writeln(sprintf('<error>%s</error>', $message)); return 1; } elseif (Application::VERSION === '@' . 'package_version' . '@') { $output->writeln('<error>Self updating has been disabled in source version.</error>'); return 1; } $exitCode = 0; $updater = new Updater(); $updater->getStrategy()->setPharUrl(self::PHAR_URL); $updater->getStrategy()->setVersionUrl(self::PHAR_VERSION_URL); try { if ($input->getOption('rollback')) { $result = $updater->rollback(); } else { $result = $updater->update(); } if ($result) { $new = $updater->getNewVersion(); $old = $updater->getOldVersion(); $output->writeln(sprintf('Updated from %s to %s', $old, $new)); } else { $exitCode = 1; } } catch (Exception $e) { $exitCode = 1; $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); } return $exitCode; }
/** * Execute * * @param InputInterface $input * @param OutputInterface $output * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $updater = new Updater(null, false); $updater->setStrategy(Updater::STRATEGY_GITHUB); $strategy = $updater->getStrategy(); /* @var GithubStrategy $strategy */ $strategy->setPackageName('TYPO3/Surf'); $strategy->setPharName('surf.phar'); $strategy->setCurrentLocalVersion($this->getApplication()->getVersion()); $stability = $input->getOption('stability'); if (empty($stability)) { // Unstable by default. Should be removed once we have a 2.0.0 final $stability = GithubStrategy::UNSTABLE; } $strategy->setStability($stability); if ($input->getOption('check')) { $result = $updater->hasUpdate(); if ($result) { $output->writeln(sprintf('The %s build available remotely is: %s', $strategy->getStability() === GithubStrategy::ANY ? 'latest' : 'current ' . $strategy->getStability(), $updater->getNewVersion())); } elseif (false === $updater->getNewVersion()) { $output->writeln('There are no new builds available.'); } else { $output->writeln(sprintf('You have the current %s build installed.', $strategy->getStability())); } } elseif ($input->getOption('rollback')) { $result = $updater->rollback(); $result ? $output->writeln('Success!') : $output->writeln('Failure!'); } else { $result = $updater->update(); $result ? $output->writeln('Updated.') : $output->writeln('No update needed!'); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { try { $result = $this->updater->rollback(); if (!$result) { $output->writeln("Rollback failed!"); return 1; } } catch (\Exception $e) { $output->writeln($e->getMessage()); $output->writeln("Unable to rollback"); return 1; } $output->writeln("Rollback successful"); return 0; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $updater = new Updater(); $updater->rollback(); $new = $updater->getNewVersion(); $old = $updater->getOldVersion(); $output->writeln(sprintf('Rolled back from %s to %s', $old, $new)); }
/** * Execute Command. * * @param InputInterface $consoleInput * @param OutputInterface $consoleOutput * * @return int|null|void */ public function execute(InputInterface $consoleInput, OutputInterface $consoleOutput) { $updater = new Updater(); $updater->setStrategy(Updater::STRATEGY_GITHUB); $updater->getStrategy()->setPackageName('kriskbx/wyn'); $updater->getStrategy()->setPharName('wyn.phar'); $updater->getStrategy()->setCurrentLocalVersion($GLOBALS['wynVersion']); try { $result = $updater->rollback(); $result ? exit('Success!') : exit('Failure!'); } catch (\Exception $e) { exit('Well, something happened! Either an oopsie or something involving hackers.'); } }
protected function execute(InputInterface $input, OutputInterface $output) { $logger = new ConsoleLogger($output); $updater = new Updater(null, false, Updater::STRATEGY_GITHUB); /** @var GithubStrategy $strategy */ $strategy = $updater->getStrategy(); $strategy->setPackageName('icehawk/component-template-generator'); $strategy->setPharName('icehawk-ctg.phar'); $strategy->setCurrentLocalVersion('@package_version@'); if ($updater->rollback()) { $logger->info('Roll back successful!'); } else { $logger->alert('Roll back failed.'); } return 0; }
protected function execute(InputInterface $input, OutputInterface $output) { $updater = new Updater(); $updater->getStrategy()->setPharUrl('https://gilbitron.github.io/Handle/handle.phar'); $updater->getStrategy()->setVersionUrl('https://gilbitron.github.io/Handle/handle.phar.version'); try { $result = $updater->rollback(); if (!$result) { $output->writeln('<error>There was an error rolling back the update</error>'); return; } $output->writeln('<info>Rollback successful</info>'); } catch (\Exception $e) { $output->writeln('<error>' . $e->getMessage() . '</error>'); } }
/** * @param Route $route * @param Console $console * @return int */ public function __invoke(Route $route, Console $console) { $console->writeLine('Rolling back to a previous installed version...', Color::GREEN); $updater = new Updater(); try { $result = $updater->rollback(); if (!$result) { $console->writeLine('Rollback failed!', Color::RED); return 1; } } catch (Exception $e) { $console->writeLine('[ERROR] Could not rollback', Color::RED); return 1; } $console->writeLine('Rollback complete!', Color::GREEN); return 0; }
/** * executes the command * * @return int */ protected function handle() { $updater = new Updater(null, false); try { $result = $updater->rollback(); if (!$result) { $this->error('Rollback failed!'); // report failure! return 1; } return 0; } catch (\Exception $e) { $this->error($e->getMessage()); // Report an error! return 1; } }
/** * @param InputInterface $input * @param OutputInterface $output * * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { $input->validate(); $logger = new ConsoleLogger($output); $updater = new Updater(null, false, Updater::STRATEGY_GITHUB); /** @var GithubStrategy $strategy */ $strategy = $updater->getStrategy(); $strategy->setPackageName(PharTool::PACKAGE_NAME); $strategy->setPharName(PharTool::PHAR_NAME); $strategy->setCurrentLocalVersion('@package_version@'); if ($updater->rollback()) { $logger->info('Roll back successful!'); } else { $logger->alert('Roll back failed.'); } return 0; }
/** * Run the command * * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $updater = new Updater(null, false); $updater->setStrategyObject(new CurlGithubStrategy()); $updater->getStrategy()->setPackageName('inetprocess/sugarcli'); $updater->getStrategy()->setPharName('sugarcli.phar'); $updater->getStrategy()->setCurrentLocalVersion($this->getApplication()->getVersion()); if ($input->getOption('rollback')) { $updater->rollback(); } else { $result = $updater->update(); if ($result) { $output->writeln('Successfuly updated'); } else { $output->writeln('Already up to date'); } } }
protected function rollback() { $updater = new Updater(); try { $result = $updater->rollback(); if ($result) { $this->output->writeln('<fg=green>Humbug has been rolled back to prior version.</fg=green>'); } else { $this->output->writeln('<fg=red>Rollback failed for reasons unknown.</fg=red>'); } } catch (\Exception $e) { $this->output->writeln(sprintf('Error: <fg=yellow>%s</fg=yellow>', $e->getMessage())); } }
protected function rollback() { $updater = new Updater(); try { $result = $updater->rollback(); if ($result) { $this->io->success("Spaceport has been rolled back to prior version."); } else { $this->io->error("Rollback failed for reasons unknown."); } } catch (\Exception $e) { $this->io->error("Error: " . $e->getMessage()); } }
protected function rollback() { $updater = new Updater(); try { $result = $updater->rollback(); if ($result) { $this->dialogProvider->logTask("Skylab has been rolled back to prior version."); } else { $this->dialogProvider->logError("Rollback failed for reasons unknown."); } } catch (\Exception $e) { $this->dialogProvider->logError("Error: " . $e->getMessage()); } }