From: Marcin Haba Date: Sun, 19 Nov 2017 17:24:56 +0000 (+0100) Subject: baculum: Support sending config as serialized array for older version X-Git-Tag: Release-9.0.6~14 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fefde9f37ad1ff7faf0570765012ab2c3d21a023;p=bacula%2Fbacula baculum: Support sending config as serialized array for older version --- diff --git a/gui/baculum/protected/API/Pages/API/Config.php b/gui/baculum/protected/API/Pages/API/Config.php index 0ecdb0c842..f1c04d248c 100644 --- a/gui/baculum/protected/API/Pages/API/Config.php +++ b/gui/baculum/protected/API/Pages/API/Config.php @@ -36,7 +36,12 @@ class Config extends BaculumAPIServer { public function set($id, $params) { $config = (array)$params; if (array_key_exists('config', $config)) { - $config = json_decode($config['config'], true); + 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(); } @@ -51,7 +56,6 @@ class Config extends BaculumAPIServer { } 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;