/** * */ public static function installCentreon() { if (Migrate::checkForMigration()) { Migrate::migrateCentreon(); } else { // Initialize configuration $di = Di::getDefault(); $config = $di->get('config'); $centreonPath = $config->get('global', 'centreon_path'); $dbName = $config->get('db_centreon', 'dbname'); // Check Php Dependencies $phpDependencies = json_decode(file_get_contents(rtrim($centreonPath, '/') . '/install/dependencies.json')); PhpDependencies::checkDependencies($phpDependencies); echo Colorize::colorizeMessage("Starting to install Centreon 3.0", "info") . "\n"; echo "Creating " . Colorize::colorizeText('centreon', 'blue', 'black', true) . " database... "; // Install DB $migrationManager = new Manager('core', 'production'); $migrationManager->generateConfiguration(); $cmd = self::getPhinxCallLine() . 'migrate '; $cmd .= '-c ' . $migrationManager->getPhinxConfigurationFile(); $cmd .= ' -e core'; shell_exec($cmd); //Db::update('core'); echo Colorize::colorizeText('Done', 'green', 'black', true) . "\n"; $modulesToInstall = self::getCoreModules(); $dependencyResolver = new Dependency($modulesToInstall['modules']); $installOrder = $dependencyResolver->resolve(); foreach ($installOrder as $moduleName) { $currentModule = $modulesToInstall['modules'][$moduleName]; $moduleInstaller = new $currentModule['classCall']($currentModule['directory'], $currentModule['infos'], 'console'); $moduleInstaller->install(); } echo Colorize::colorizeMessage("Centreon 3.0 has been successfully installed", "success") . "\n"; } }
public static function upgradeCentreon() { if (Migrate::checkForMigration()) { Migrate::migrateCentreon(); } else { Installer::updateDb('migrate'); $modulesToUpgrade = self::getCoreModules(); foreach ($modulesToUpgrade as $module) { $moduleInstaller = new $module['classCall']($module['directory'], $module['infos']); $moduleInstaller->install(); } } }