예제 #1
0
 public function init()
 {
     parent::init();
     Event::on(Supervisor::className(), Supervisor::EVENT_CONFIG_CHANGED, function () {
         exec('supervisorctl update', $output, $status);
     });
     \Yii::configure($this, require __DIR__ . '/config.php');
     $this->params['supervisorConnection'] = array_merge($this->params['supervisorConnection'], $this->authData);
     $this->registerIoC();
 }
 public function actionProcessConfigControl()
 {
     $request = \Yii::$app->request;
     $actionType = $request->post('actionType');
     $response = ['isSuccessful' => true];
     try {
         $group = new ProcessConfig($request->post('groupName'));
         if ($group->hasMethod($actionType)) {
             $group->{$actionType}();
         }
         Event::trigger(Supervisor::className(), Supervisor::EVENT_CONFIG_CHANGED);
     } catch (SupervisorException $error) {
         $response = ['isSuccessful' => false, 'error' => $error->getMessage()];
     }
     return $response;
 }