output->writeln('Updating October...'); $manager = UpdateManager::instance()->resetNotes(); $forceUpdate = $this->option('force'); $pluginsOnly = $this->option('plugins'); $coreOnly = $this->option('core'); $updateList = $manager->requestUpdateList($forceUpdate); $updates = (int)array_get($updateList, 'update', 0); if ($updates == 0) { $this->output->writeln('No new updates found'); return; } else { $this->output->writeln(sprintf('Found %s new %s!', $updates, Str::plural('update', $updates))); } $coreHash = $pluginsOnly ? null : array_get($updateList, 'core.hash'); $coreBuild = array_get($updateList, 'core.build'); if ($coreHash) { $this->output->writeln('Downloading application files'); $manager->downloadCore($coreHash); } $plugins = $coreOnly ? [] : array_get($updateList, 'plugins'); foreach ($plugins as $code => $plugin) { $pluginName = array_get($plugin, 'name'); $pluginHash = array_get($plugin, 'hash'); $this->output->writeln(sprintf('Downloading plugin: %s', $pluginName)); $manager->downloadPlugin($code, $pluginHash); } if ($coreHash) { $this->output->writeln('Unpacking application files'); $manager->extractCore($coreHash, $coreBuild); } foreach ($plugins as $code => $plugin) { $pluginName = array_get($plugin, 'name'); $pluginHash = array_get($plugin, 'hash'); $this->output->writeln(sprintf('Unpacking plugin: %s', $pluginName)); $manager->extractPlugin($code, $pluginHash); } /* * Run migrations */ $this->call('october:up'); } /** * Get the console command arguments. */ protected function getArguments() { return []; } /** * Get the console command options. */ protected function getOptions() { return [ ['force', null, InputOption::VALUE_NONE, 'Force updates.'], ['core', null, InputOption::VALUE_NONE, 'Update core application files only.'], ['plugins', null, InputOption::VALUE_NONE, 'Update plugin files only.'], ]; } }