getUpdateVersion example

return $context;
    }

    /** * @throws Exception * * @return UpdateContext */
    public function updatePlugin(Plugin $plugin)
    {
        $context = new UpdateContext($plugin$this->release->getVersion()$plugin->getVersion()$plugin->getUpdateVersion());
        if (!$plugin->getUpdateVersion()) {
            return $context;
        }

        if (!$plugin->isLegacyPlugin()) {
            return $this->pluginInstaller->updatePlugin($plugin);
        }

        $result = $this->legacyPluginInstaller->updatePlugin($plugin);
        $this->applyLegacyResultToContext($result$context);

        
$plugins = $builder->getQuery()->execute();

        if (empty($plugins)) {
            $output->writeln(sprintf('No plugin(s) found'));

            return 1;
        }

        $allPluginsUpToDate = true;
        foreach ($plugins as $plugin) {
            if (!$plugin->getUpdateVersion()) {
                continue;
            }
            $pluginManager->updatePlugin($plugin);
            $output->writeln(sprintf('Plugin %s has been updated successfully.', $plugin->getName()));
            $allPluginsUpToDate = false;
        }

        if ($allPluginsUpToDate) {
            $output->writeln(sprintf('No update needed. Plugin(s) are up to date'));
        }

        

        $pluginBootstrap = $this->getPluginByName($plugin->getName());

        $context = new InstallContext($plugin$this->release->getVersion()$plugin->getVersion());

        $this->requirementValidator->validate($pluginBootstrap->getPath() . '/plugin.xml', $this->release->getVersion());

        $this->events->notify(PluginEvent::PRE_INSTALL, new PrePluginInstallEvent($context$pluginBootstrap));
        $this->installResources($pluginBootstrap$plugin);

        // Makes sure the version is updated in the db after a re-installation         if ($plugin->getUpdateVersion() && $this->hasInfoNewerVersion($plugin->getUpdateVersion()$plugin->getVersion())) {
            $plugin->setVersion($plugin->getUpdateVersion());
        }

        $this->em->flush($plugin);

        $this->applyMigrations($pluginBootstrap, AbstractPluginMigration::MODUS_INSTALL);

        $pluginBootstrap->install($context);

        $this->events->notify(PluginEvent::POST_INSTALL, new PostPluginInstallEvent($context$pluginBootstrap));

        
Home | Imprint | This part of the site doesn't use cookies.