/** * * @param integer $onlyActivated If list only module activated * @return array Array of arrays describing modules */ public static function getModuleExtendedList($onlyActivated = 1) { $activated = array('0', '1', '2'); if ($onlyActivated == 1) { $activated = array('1', '2'); } try { $rawModuleList = Module::getList('*', -1, 0, 'name', 'ASC', array('isactivated' => $activated)); } catch (\PDOException $e) { } return $rawModuleList; }
/** * * @param string $operationType * @param string $targetDbName * @return array */ private static function getAllXmlFiles($operationType = 'update', $targetDbName = 'centreon') { // Initialize configuration $di = Di::getDefault(); $config = $di->get('config'); $centreonPath = $config->get('global', 'centreon_path'); $xmlDbFiles = glob(realpath(rtrim($centreonPath, '/') . '/install/db/' . $targetDbName) . '/*.xml'); // Module if ($operationType == 'update') { $registeredModules = Module::getList('name'); $registeredModules(array_merge($registeredModules, Informations::getCoreModuleList())); foreach ($registeredModules as $module) { $module['name'] = str_replace(' ', '', ucwords(str_replace('-', ' ', $module['name']))) . 'Module'; $xmlDbFiles = array_merge($xmlDbFiles, glob(realpath(rtrim($centreonPath, '/') . '/modules') . '/' . $module['name'] . '/install/db/' . $targetDbName . '/*.xml')); } } else { $xmlDbFiles = array_merge($xmlDbFiles, glob(realpath(rtrim($centreonPath, '/') . '/modules') . '/*Module/install/db/' . $targetDbName . '/*.xml')); } return $xmlDbFiles; }