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(); }
/** * Process constructor. * * @param string $processName * @param ConnectionInterface $connection */ public function __construct($processName, ConnectionInterface $connection) { $this->_processName = $processName; parent::__construct($connection); }
/** * 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; }