Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 /**
  * @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;
 }
Пример #3
0
 /**
  * @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);
 }