public function installAction() { if (null !== ($response = $this->checkAuth(AdminResources::MODULE, array(), AccessManager::CREATE))) { return $response; } $newModule = null; $moduleDefinition = null; /** @var ModuleInstallForm $moduleInstall */ $moduleInstall = $this->createForm(AdminForm::MODULE_INSTALL); try { $this->validateForm($moduleInstall, "post"); $moduleDefinition = $moduleInstall->getModuleDefinition(); $modulePath = $moduleInstall->getModulePath(); $moduleInstallEvent = new ModuleInstallEvent(); $moduleInstallEvent->setModulePath($modulePath)->setModuleDefinition($moduleDefinition); $this->dispatch(TheliaEvents::MODULE_INSTALL, $moduleInstallEvent); $newModule = $moduleInstallEvent->getModule(); if (null !== $newModule) { $this->getSession()->getFlashBag()->add('module-installed', $this->getTranslator()->trans('The module %module has been installed successfully.', ['%module' => $moduleDefinition->getCode()])); return $this->generateRedirectFromRoute('admin.module'); } else { $message = $this->getTranslator()->trans("Sorry, an error occured."); } } catch (FormValidationException $e) { $message = $e->getMessage(); } catch (\Exception $e) { $message = $this->getTranslator()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()]); } Tlog::getInstance()->error(sprintf("Error during module installation process. Exception was %s", $message)); $moduleInstall->setErrorMessage($message); $this->getParserContext()->addForm($moduleInstall)->setGeneralError($message); return $this->render("modules"); }