示例#1
0
 /**
  * Generic function
  *
  */
 public function genericAction($action)
 {
     $di = Di::getDefault();
     $router = $di->get('router');
     $param = $router->request()->paramsNamed();
     $obj = new ConfigApplyRepository($param["id"]);
     $obj->action($action);
     $router->response()->json(array("status" => $obj->getStatus(), "output" => $obj->getOutput()));
 }
示例#2
0
 /**
 
     /**
 * @cmdObject string poller the poller slug
 * @cmdParam string action required the action 
 */
 public function applyAction($object, $param)
 {
     $exit = 1;
     $id = PollerRepository::getIdBySlugName($object['poller']);
     if (!is_null($id)) {
         $action = $param['action'];
         $obj = new ConfigApplyRepository($id);
         $obj->action($action);
         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);
 }