getPluginBootstrap example


    }

    /** * Cron action method * * Sends the newsletter emails as a cronjob. */
    public function cronAction()
    {
        /** @var Shopware_Plugins_Core_Cron_Bootstrap|null $cronBootstrap */
        $cronBootstrap = $this->getPluginBootstrap('Cron');
        if ($cronBootstrap && !$cronBootstrap->authorizeCronAction($this->Request())) {
            $this->Response()
                ->clearHeaders()
                ->setStatusCode(Response::HTTP_FORBIDDEN)
                ->appendBody('Forbidden');

            return;
        }

        $this->Response()->headers->set('content-type', 'text/plain');
        $this->mailAction();
    }
return $plugin;
    }

    /** * Returns a certain plugin by plugin id. * * @return Shopware_Components_Plugin_Bootstrap|null */
    public function getPluginBootstrap(Plugin $plugin)
    {
        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 $pluginByName;
    }

    /** * @throws Exception * * @return array */
    public function installPlugin(Plugin $plugin)
    {
        $bootstrap = $this->getPluginBootstrap($plugin);

        /** @var Shopware_Components_Plugin_Namespace $namespace */
        $namespace = $bootstrap->Collection();

        try {
            $result = $namespace->installPlugin($bootstrap);
        } catch (Exception $e) {
            throw new Exception(sprintf("Unable to install '%s', got exception:\n%s\n", $plugin->getName()$e->getMessage()), 0, $e);
        }

        $result = \is_bool($result) ? ['success' => $result] : $result;

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