/** * * @param string $method * @return array */ public function action($method) { try { $event = $this->di->get('events'); /* Engine */ $this->output[] = sprintf(_("Performing %s action on Engine..."), $method); $engineEvent = new EngineProcess($this->pollerId, $method); $event->emit("centreon-configuration.engine.process", array($engineEvent)); $this->output = array_merge($this->output, $engineEvent->getOutput()); // Check Engine action is OK before going on with Broker if ($engineEvent->getStatus()) { /* Broker */ $this->output[] = sprintf(_("Performing %s action on Broker..."), $method); $brokerEvent = new BrokerProcess($this->pollerId, $method); $event->emit("centreon-configuration.broker.process", array($brokerEvent)); $this->output = array_merge($this->output, $brokerEvent->getOutput()); if (!$brokerEvent->getStatus()) { $this->status = false; } } else { $this->status = false; } } catch (Exception $e) { $this->output[] = $e->getMessage(); $this->status = false; } }