Exemple #1
0
 /**
  * Installs a plugin
  *
  * @param integer $p
  */
 public function installPlugin($pluginId)
 {
     $plugins = $this->entityManager->getRepository($this->modelNamespace)->findById($pluginId);
     if (count($plugins) != 1) {
         throw new PluginNotFoundException("The plugin cannot be found");
     }
     $plugin = $plugins[0];
     if ($plugin->isActive()) {
         throw new PluginStatusException("Plugin is already installed.");
     }
     $pluginInstance = $this->getPlugin($plugin->getName());
     $plugin->setActivated(true);
     $app = new Application($this->framework->getKernel());
     $app->setAutoExit(false);
     $input = new StringInput("doctrine:schema:update --force");
     $fp = fopen('php://temp/maxmemory:' . 1024 * 1024 * 512, 'r+');
     $output = new StreamOutput($fp);
     $error = $app->run($input, $output);
     rewind($fp);
     if ($error != 0) {
         $msg = "Error: {$error}\n" . stream_get_contents($fp);
         throw new PluginStatusException($msg);
     } else {
         $msg = stream_get_contents($fp);
     }
     $this->entityManager->flush();
     $pluginInstance->install();
 }
Exemple #2
0
 /**
  * Internal class to setup smarty with a bunch of config parameters.
  */
 protected function setupSmarty()
 {
     $p = $this->framework->getCacheDir() . "smarty/";
     $this->setCacheDir($p);
     $this->setCompileDir($p . "compile/");
     $this->setTemplateDir($this->framework->getTemplateDirs());
     $this->error_reporting = 0;
     $this->clearAllCache();
     $this->caching = \Smarty::CACHING_LIFETIME_CURRENT;
     $this->addPluginsDir(__DIR__ . "/Plugins");
 }