/** * Execute action * * @param \CentreonConfiguration\Events\SynchronizeFiles $event * @throws Exception */ public static function execute(SynchronizeFilesEvent $event) { $endpoints = BrokerRepository::getConfigEndpoints($event->getPollerId()); foreach ($endpoints as $endpoint) { try { BrokerRepository::sendCommand($event->getPollerId(), $endpoint . ';DUMP_DIR'); } catch (\Exception $e) { $event->setOutput($e->getMessage()); } } }
/** * Move configuration files * */ public function moveConfig() { try { /* Get Path */ $event = $this->di->get('events'); $eventObj = new CopyFiles($this->pollerId); $event->emit('centreon-configuration.copy.files', array($eventObj)); $this->output = array_merge($this->output, $eventObj->getOutput()); /* Event for external commands */ $eventObj = new SynchronizeFiles($this->pollerId); $event->emit('centreon-configuration.synchronize.files', array($eventObj)); $this->output = array_merge($this->output, $eventObj->getOutput()); /* Synchronize Database */ $eventObj = new SynchronizeDatabase($this->pollerId); $event->emit('centreon-configuration.synchronize.database', array($eventObj)); $this->output = array_merge($this->output, $eventObj->getOutput()); } catch (Exception $e) { $this->output[] = $e->getMessage(); $this->status = false; } }