/** * deactivate httpCache-Plugin * @param Plugin $httpCache */ private function deactivateHttpCache($httpCache) { if (!$httpCache->getActive()) { return; } /**@var $service InstallerService*/ $service = Shopware()->Container()->get('shopware.plugin_manager'); $service->deactivatePlugin($httpCache); }
/** * @param Plugin $plugin * @throws \Exception */ public function deactivatePlugin(Plugin $plugin) { if (!$plugin->getActive()) { return; } $bootstrap = $this->getPluginBootstrap($plugin); $result = $bootstrap->disable(); $result = is_bool($result) ? ['success' => $result] : $result; if ($result['success'] == false) { throw new \Exception('Not allowed to disable plugin.'); } $plugin->setActive(false); $this->em->flush($plugin); return $result; }
/** * @param Plugin $plugin * @throws \Exception */ public function deactivatePlugin(Plugin $plugin) { if (!$plugin->getActive()) { return; } $bootstrap = $this->getPluginBootstrap($plugin); $isAllowed = $bootstrap->disable(); $isAllowed = is_bool($isAllowed) ? $isAllowed : !empty($isAllowed['success']); if (!$isAllowed) { throw new \Exception('Not allowed to disable plugin.'); } $plugin->setActive(false); $this->em->flush($plugin); }