Example #1
0
 /**
  * Execute action 
  *
  * @param \CentreonConfiguration\Events\SynchronizeDatabase $event
  * @throws Exception
  */
 public static function execute(SynchronizeDatabaseEvent $event)
 {
     try {
         BrokerRepository::sendCommand($event->getPollerId(), 'SYNC_CFG_DB;' . $event->getPollerId());
     } catch (\Exception $e) {
         $event->setOutput($e->getMessage());
     }
 }
Example #2
0
 /**
  * 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;
     }
 }