(eg: Winter.Blog)}'; /** * @var string The console command description. */ protected $description = 'Install a plugin from the Winter marketplace.'; /** * Execute the console command. * @return void */ public function handle() { $pluginName = $this->argument('plugin'); $manager = UpdateManager::instance()->setNotesOutput($this->output); $pluginDetails = $manager->requestPluginDetails($pluginName); $code = array_get($pluginDetails, 'code'); $hash = array_get($pluginDetails, 'hash'); $this->output->writeln(sprintf('Downloading plugin: %s', $code)); $manager->downloadPlugin($code, $hash, true); $this->output->writeln(sprintf('Unpacking plugin: %s', $code)); $manager->extractPlugin($code, $hash); /* * Make sure plugin is registered */ $pluginManager = PluginManager::instance(); $pluginManager->loadPlugins(); $plugin = $pluginManager->findByIdentifier($code); $pluginManager->registerPlugin($plugin, $code); /* * Migrate plugin */ $this->output->writeln(sprintf('Migrating plugin...', $code)); $manager->updatePlugin($code); } }