Exemplo n.º 1
0
 /**
  * Action for Generating configuration files
  *
  * @method GET
  * @route /generatecfg/[i:id]
  */
 public function generateAction()
 {
     $di = Di::getDefault();
     $router = $di->get('router');
     $param = $router->request()->paramsNamed();
     $obj = new ConfigGenerateRepository($param["id"]);
     $obj->generate();
     $router->response()->json(array("status" => $obj->getStatus(), "output" => $obj->getOutput()));
 }
Exemplo n.º 2
0
 /**
  * @cmdObject string poller the poller slug
  */
 public function generateAction($object)
 {
     $exit = 1;
     $id = PollerRepository::getIdBySlugName($object['poller']);
     if (!is_null($id)) {
         $obj = new ConfigGenerateRepository($id);
         $obj->generate();
         echo $obj->getOutput();
         if ($obj->getStatus() === 1) {
             $exit = 0;
         } else {
             $exit = 1;
         }
     } else {
         \Centreon\Internal\Utils\CommandLine\InputOutput::display("Error : Poller not in Database", true, 'red');
         $exit = 1;
     }
     exit($exit);
 }