/** * Perform uninstall operation for module * * @throws NotInstalledException * @throws CoreModuleRemovalConstraintException */ public function uninstall() { if (!Informations::isModuleInstalled($this->moduleSlug)) { $exceptionMessage = _("The given module is not installed"); throw new NotInstalledException($this->colorizeMessage($exceptionMessage, 'danger'), 1109); } $coreModule = Informations::getCoreModuleList(); if (in_array($this->moduleSlug, $coreModule)) { $exceptionMessage = _("This module is a core module and therefore can't be uninstalled"); throw new CoreModuleRemovalConstraintException($this->colorizeMessage($exceptionMessage, 'danger'), 1103); } // Starting Message $message = _("Starting removal of %s module"); $this->displayOperationMessage($this->colorizeMessage(sprintf($message, $this->moduleFullName), 'info')); // Performing pre operation check $this->checkOperationValidity('uninstall'); // Set TemporaryVersion $this->versionManager->setTemporaryVersion('uninstall', true); $this->moduleId = Informations::getModuleIdByName($this->moduleSlug); // $this->preRemove(); $this->removeHook(); // Remove old static files $this->removeStaticFiles(); //Remove validators $this->removeValidators(); // Custom removal of the module $this->customRemove(); $this->postRemove(); // Ending Message $message = _("Removal of %s module complete"); $this->displayOperationMessage($this->colorizeMessage(sprintf($message, $this->moduleFullName), 'success')); }