Exemplo n.º 1
0
 /**
  * activate httpCache-Plugin
  * @param Plugin $httpCache
  */
 private function activeHttpCache($httpCache)
 {
     /**@var $service InstallerService*/
     $service = Shopware()->Container()->get('shopware.plugin_manager');
     if (!$httpCache->getInstalled()) {
         $service->installPlugin($httpCache);
     }
     if (!$httpCache->getActive()) {
         $service->activatePlugin($httpCache);
     }
 }
Exemplo n.º 2
0
 /**
  * @param Plugin $plugin
  * @throws \Exception
  */
 public function activatePlugin(Plugin $plugin)
 {
     if ($plugin->getActive()) {
         return;
     }
     if (!$plugin->getInstalled()) {
         throw new \Exception('Plugin has to be installed first.');
     }
     $bootstrap = $this->getPluginBootstrap($plugin);
     $result = $bootstrap->enable();
     $result = is_bool($result) ? ['success' => $result] : $result;
     if ($result['success'] == false) {
         throw new \Exception('Not allowed to enable plugin.');
     }
     $plugin->setActive(true);
     $this->em->flush($plugin);
     return $result;
 }
Exemplo n.º 3
0
 /**
  * @param Plugin $plugin
  * @throws \Exception
  */
 public function activatePlugin(Plugin $plugin)
 {
     if ($plugin->getActive()) {
         return;
     }
     if (!$plugin->getInstalled()) {
         throw new \Exception('Plugin has to be installed first.');
     }
     $bootstrap = $this->getPluginBootstrap($plugin);
     $isAllowed = $bootstrap->enable();
     $isAllowed = is_bool($isAllowed) ? $isAllowed : !empty($isAllowed['success']);
     if (!$isAllowed) {
         throw new \Exception('Not allowed to enable plugin.');
     }
     $plugin->setActive(true);
     $this->em->flush($plugin);
 }