Exemplo n.º 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();
 }
Exemplo n.º 2
0
 /**
  * Process constructor.
  *
  * @param string              $processName
  * @param ConnectionInterface $connection
  */
 public function __construct($processName, ConnectionInterface $connection)
 {
     $this->_processName = $processName;
     parent::__construct($connection);
 }
Exemplo n.º 3
0
 /**
  * Group constructor.
  *
  * @param string              $groupName
  * @param ConnectionInterface $connection
  * @param array               $config
  */
 public function __construct($groupName, ConnectionInterface $connection, $config = [])
 {
     $this->_groupName = $groupName;
     parent::__construct($connection, $config);
 }
 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;
 }