Example #1
0
 /**
  * Update plugin from URL
  *
  * @throws \Kanboard\Core\Controller\AccessForbiddenException
  */
 public function update()
 {
     $this->checkCSRFParam();
     $pluginArchiveUrl = urldecode($this->request->getStringParam('archive_url'));
     try {
         $installer = new Installer($this->container);
         $installer->update($pluginArchiveUrl);
         $this->flash->success(t('Plugin updated successfully.'));
     } catch (PluginInstallerException $e) {
         $this->flash->failure($e->getMessage());
     }
     $this->response->redirect($this->helper->url->to('PluginController', 'show'));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!Installer::isConfigured()) {
         $output->writeln('<error>Kanboard is not configured to upgrade plugins itself</error>');
     }
     $installer = new Installer($this->container);
     $availablePlugins = $this->httpClient->getJson(PLUGIN_API_URL);
     foreach ($this->pluginLoader->getPlugins() as $installedPlugin) {
         $pluginDetails = $this->getPluginDetails($availablePlugins, $installedPlugin);
         if ($pluginDetails === null) {
             $output->writeln('<error>* Plugin not available in the directory: ' . $installedPlugin->getPluginName() . '</error>');
         } elseif ($pluginDetails['version'] > $installedPlugin->getPluginVersion()) {
             $output->writeln('<comment>* Updating plugin: ' . $installedPlugin->getPluginName() . '</comment>');
             $installer->update($pluginDetails['download']);
         } else {
             $output->writeln('<info>* Plugin up to date: ' . $installedPlugin->getPluginName() . '</info>');
         }
     }
 }