refreshPluginList example


    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var InstallerService $pluginManager */
        $pluginManager = $this->container->get(InstallerService::class);
        if (!$input->getOption('no-refresh')) {
            $pluginManager->refreshPluginList();
            $output->writeln('Successfully refreshed');
        }
        $pluginName = $input->getArgument('plugin');

        try {
            $plugin = $pluginManager->getPluginByName($pluginName);
        } catch (Exception $e) {
            $output->writeln(sprintf('Plugin by name "%s" was not found.', $pluginName));

            return 1;
        }

        
EOF
            );
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $pluginManager = $this->container->get(InstallerService::class);
        if (!$input->getOption('no-refresh')) {
            $pluginManager->refreshPluginList();
            $output->writeln('Successfully refreshed');
        }

        $pluginNames = $input->getArgument('plugin');

        $batchUpdate = $input->getOption('batch');
        if (!empty($batchUpdate)) {
            return $this->batchUpdate($pluginManager$batchUpdate$output);
        }

        if (!empty($pluginNames)) {
            
if (!\is_string($downloadsDir)) {
            throw new RuntimeException('Parameter shopware.app.downloadsDir has to be a string');
        }

        $filePath = rtrim($downloadsDir, '/') . DIRECTORY_SEPARATOR . $metaStruct->getFileName();
        $service = Shopware()->Container()->get('shopware_plugininstaller.plugin_download_service');

        try {
            $service->extractPluginZip($filePath$metaStruct->getTechnicalName());

            $pluginManager = $this->get(InstallerService::class);
            $pluginManager->refreshPluginList();
        } catch (Exception $e) {
            $this->View()->assign(['success' => false, 'message' => $e->getMessage()]);

            return;
        }

        $this->View()->assign('success', true);
    }

    /** * @return void */
$this->pluginManager = $this->get(\Shopware\Bundle\PluginInstallerBundle\Service\InstallerService::class);
    }

    public function installPluginAction()
    {
        @set_time_limit(300);

        $plugin = $this->getPluginModel($this->Request()->getParam('technicalName'));

        if (!$plugin instanceof Plugin) {
            $this->pluginManager->refreshPluginList();
            $plugin = $this->getPluginModel($this->Request()->getParam('technicalName'));
        }

        if (!$plugin instanceof Plugin) {
            $this->View()->assign([
                'success' => false,
                'message' => sprintf('Plugin not found %s', $this->Request()->getParam('technicalName')),
            ]);

            return;
        }

        

    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var InstallerService $pluginManager */
        $pluginManager = $this->container->get(\Shopware\Bundle\PluginInstallerBundle\Service\InstallerService::class);
        if (!$input->getOption('no-refresh')) {
            $pluginManager->refreshPluginList();
            $output->writeln('Successfully refreshed');
        }
        $pluginName = $input->getArgument('plugin');

        try {
            $plugin = $pluginManager->getPluginByName($pluginName);
        } catch (Exception $e) {
            $output->writeln(sprintf('Plugin by name "%s" was not found.', $pluginName));

            return 1;
        }

        
/** @var Shop $shop */
            $shop = $this->shopRepository->find($this->shopRepository->getActiveDefault()->getId());
        }

        $this->configWriter->saveConfigElement($plugin$name$value$shop);
    }

    public function refreshPluginList()
    {
        $refreshDate = new DateTimeImmutable();

        $this->pluginInstaller->refreshPluginList($refreshDate);
        $this->legacyPluginInstaller->refreshPluginList($refreshDate);
    }

    /** * @param bool|array $result * @param InstallContext|ActivateContext|DeactivateContext|UninstallContext|UpdateContext $context */
    private function applyLegacyResultToContext($result, InstallContext $context)
    {
        if (\is_bool($result)) {
            return;
        }
default:
                    $this->handleLicenceInstall($plugin$domain$version$token);
                    break;
            }
        } catch (Exception $e) {
            $io->error('An error occured: ' . $e->getMessage());
            exit(1);
        }

        try {
            $this->clearOpcodeCache();
            $this->container->get(InstallerService::class)->refreshPluginList();

            $this->io->success('Process completed successfully.');
        } catch (Exception $e) {
        }

        return 0;
    }

    /** * @param string $domain * @param string $version * * @throws Exception */
->setDescription('Refreshes plugin list.')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var InstallerService $pluginManager */
        $pluginManager = $this->container->get(\Shopware\Bundle\PluginInstallerBundle\Service\InstallerService::class);
        $pluginManager->refreshPluginList();

        $output->writeln(sprintf('Successfully refreshed'));

        return 0;
    }
}
Home | Imprint | This part of the site doesn't use cookies.