Beispiel #1
0
 /**
  * Check if module can be deactivated safely because other modules
  * could have dependencies to this module
  *
  * @param  \Thelia\Model\Module $module
  * @return bool                 true if the module can be deactivated, otherwise false
  */
 private function checkDeactivation($module)
 {
     $moduleValidator = new ModuleValidator($module->getAbsoluteBaseDir());
     $modules = $moduleValidator->getModulesDependOf();
     if (count($modules) > 0) {
         $moduleList = implode(', ', array_column($modules, 'code'));
         $message = count($modules) == 1 ? Translator::getInstance()->trans('%s has dependency to module %s. You have to deactivate this module before.') : Translator::getInstance()->trans('%s have dependencies to module %s. You have to deactivate these modules before.');
         throw new ModuleException(sprintf($message, $moduleList, $moduleValidator->getModuleDefinition()->getCode()));
     }
     return true;
 }