/** * * @param string $module * @param string $params * @return array */ public static function getChildren($module, $params = 'name') { $finalChildrenList = array(); $currentModuleId = static::getModuleIdByName($module); $childrenList = ModuleDependency::getList('child_id', -1, 0, null, "ASC", array('parent_id' => $currentModuleId)); foreach ($childrenList as $child) { $childInfo = Module::get($child['child_id'], $params); if (count($childInfo) > 0) { $finalChildrenList[] = $childInfo; } } return $finalChildrenList; }
/** * * @method get * @route /extensions/module/[i:id]/uninstall */ public function uninstallModuleAction() { $router = $this->di->get('router'); $params = $this->getParams(); $module = Module::get($params['id']); $config = $this->di->get('config'); $centreonPath = $config->get('global', 'centreon_path'); $commonName = str_replace(' ', '', ucwords(str_replace('-', ' ', $module['name']))); $moduleDirectory = $centreonPath . 'modules/' . $commonName . 'Module/'; $classCall = '\\' . $commonName . '\\Install\\Installer'; $moduleInstaller = new $classCall($moduleDirectory, $module); $moduleInstaller->remove(); $backUrl = $router->getPathFor('/centreon-administration/extensions/module'); $router->response()->redirect($backUrl, 200); }