Request->contains('component_type') ? $this->Request['component_type'] : null; $resource_type = $this->Request->contains('resource_type') ? $this->Request['resource_type'] : null; $resource_name = $this->Request->contains('resource_name') ? $this->Request['resource_name'] : null; $config = $this->getModule('bacula_setting')->getConfig($component_type, $resource_type, $resource_name); $this->output = $config['output']; $this->error = $config['exitcode']; } public function set($id, $params) { $config = (array)$params; if (array_key_exists('config', $config)) { if ($this->getClientVersion() <= 0.2) { // old way sending config as serialized array $config = unserialize($config['config']); } else { $config = json_decode($config['config'], true); } } else { $config = array(); } $component_type = $this->Request->contains('component_type') ? $this->Request['component_type'] : null; $resource_type = $this->Request->contains('resource_type') ? $this->Request['resource_type'] : null; $resource_name = $this->Request->contains('resource_name') ? $this->Request['resource_name'] : null; $result = $this->getModule('bacula_setting')->setConfig($config, $component_type, $resource_type, $resource_name); if ($result['save_result'] === true) { $this->output = BaculaConfigError::MSG_ERROR_NO_ERRORS; $this->error = BaculaConfigError::ERROR_NO_ERRORS; } else if ($result['is_valid'] === false) { $this->output = BaculaConfigError::MSG_ERROR_CONFIG_VALIDATION_ERROR . print_r($result['result'], true); $this->error = BaculaConfigError::ERROR_CONFIG_VALIDATION_ERROR; } else { $this->output = BaculaConfigError::MSG_ERROR_WRITE_TO_CONFIG_ERROR . print_r($result['result'], true); $this->error = BaculaConfigError::ERROR_WRITE_TO_CONFIG_ERROR; } } }