/** * Generate all configuration files * */ public function generate() { try { $this->checkPollerInformations(); $event = $this->di->get('events'); /* Engine conf generation */ $engineEvent = new GenerateEngine($this->pollerId); $event->emit('centreon-configuration.generate.engine', array($engineEvent)); $this->output = array_merge($this->output, $engineEvent->getOutput()); } catch (Exception $e) { $this->output[] = $e->getMessage(); $this->status = false; } }
/** * * @param \CentreonConfiguration\Events\GenerateEngine */ public static function execute(GenerateEngineEvent $event) { static::$event = $event; $config = Di::getDefault()->get('config'); static::$path = $config->get('global', 'centreon_generate_tmp_dir'); static::$path = rtrim(static::$path, '/') . '/engine/generate/'; static::$fileList = array(); $output = array(); exec("rm -rf " . static::$path . $event->getPollerId() . "/* 2>&1", $output, $statusDelete); if ($statusDelete) { $event->setOutput(_('Error while deleting Engine temporary configuration files') . "\n" . implode("\n", $output)); } $event->setOutput(sprintf(_('Generating temporary configuration files for poller %s:'), $event->getPollerId())); static::generateObjectsFiles(); static::generateMainFiles(); }
/** * * @param \CentreonConfiguration\Events\GenerateEngine $event */ public static function execute(GenerateEngineEvent $event) { static::$event = $event; $config = Di::getDefault()->get('config'); static::$path = $config->get('global', 'centreon_generate_tmp_dir'); static::$path = rtrim(static::$path, '/') . '/broker/generate/'; static::$fileList = array(); $config = Di::getDefault()->get('config'); $path = $config->get('global', 'centreon_generate_tmp_dir'); $path = rtrim($path, '/') . '/broker/generate/'; $output = array(); exec("rm -rf " . $path . $event->getPollerId() . "/* 2>&1", $output, $statusDelete); if ($statusDelete) { $event->setOutput(_('Error while deleting Broker temporary configuration files') . "\n" . implode("\n", $output)); } $configBroker = new ConfigGenerateRepository(); $configBroker->generate($event->getPollerId()); ConfigCorrelationRepository::generate($event->getPollerId()); static::generateObjectsFiles(); }