/**
  * Install one module and its dependency if he could
  * @params array $arModule array of all module which could be install
  * @params string $module module to install
  * @params array $arError array of errors
  * @return boolean
  */
 function _installOneModule($module, $arModules, &$arError)
 {
     $install = true;
     $arInstalledModule = CopixModule::getList();
     //get the module config
     $toInstall = CopixModule::getInformations($module);
     if (!in_array($toInstall->name, $arInstalledModule)) {
         //check if the installation required another module installation
         if (count($toInstall->dependencies) > 0) {
             foreach ($toInstall->dependencies as $dependency) {
                 if (!in_array($dependency, $arInstalledModule)) {
                     if (in_array($dependency, $arModules)) {
                         if (!CopixModule::_installOneModule($dependency, $arModules, $arError)) {
                             //dependency can't be installed
                             $install = false;
                         }
                     } else {
                         //dependency is not install and is not in install array
                         $install = false;
                     }
                     if (!$install) {
                         $arError[] = CopixI18N::get('copix:copixmodule.error.unableToInstall') . ' ' . $toInstall->name . ', ' . CopixI18N::get('copix:copixmodule.error.missingDependencies') . ' ' . $dependency;
                     }
                 }
             }
         }
         if ($install) {
             $scriptFile = CopixModule::_getInstallFile($toInstall->name);
             if ($scriptFile) {
                 $ct = CopixDBFactory::getConnection();
                 $ct->doSQLScript($scriptFile);
             } else {
             }
             CopixModule::_addModuleInDatabase($toInstall->name);
             CopixModule::_addModuleInPHPCache($toInstall->name);
             return true;
         } else {
             return false;
         }
     } else {
         return true;
     }
 }