InstallContext example


        return $this->legacyPluginInstaller->getPluginBootstrap($plugin);
    }

    /** * @throws Exception * * @return InstallContext */
    public function installPlugin(Plugin $plugin)
    {
        $context = new InstallContext($plugin$this->release->getVersion()$plugin->getVersion());
        if ($plugin->getInstalled()) {
            return $context;
        }

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

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

        


    /** * @throws Exception * * @return InstallContext */
    public function installPlugin(Plugin $plugin)
    {
        $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());
        }

        
$context = Context::createDefaultContext();
        $rulePlugin = new RulePlugin(false, '');

        $collection = new MigrationCollection(
            new MigrationSource('asd', []),
            new MigrationRuntime(new NullConnection()new NullLogger()),
            new NullConnection()
        );

        return [
            [new PluginPostInstallEvent($pluginnew InstallContext($rulePlugin$context, '', '', $collection))],
            [new PluginPostActivateEvent($pluginnew ActivateContext($rulePlugin$context, '', '', $collection))],
            [new PluginPostUpdateEvent($pluginnew UpdateContext($rulePlugin$context, '', '', $collection, ''))],
            [new PluginPostDeactivateEvent($pluginnew DeactivateContext($rulePlugin$context, '', '', $collection))],
            [new PluginPostUninstallEvent($pluginnew UninstallContext($rulePlugin$context, '', '', $collection, true))],
        ];
    }
}

/** * @internal */


    /** * @throws RequirementStackException */
    public function installPlugin(PluginEntity $plugin, Context $shopwareContext): InstallContext
    {
        $pluginData = [];
        $pluginBaseClass = $this->getPluginBaseClass($plugin->getBaseClass());
        $pluginVersion = $plugin->getVersion();

        $installContext = new InstallContext(
            $pluginBaseClass,
            $shopwareContext,
            $this->shopwareVersion,
            $pluginVersion,
            $this->createMigrationCollection($pluginBaseClass)
        );

        if ($plugin->getInstalledAt()) {
            return $installContext;
        }

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