From 55e847a5c98a13a2c3f9a7563906af84d43b3d43 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 31 Mar 2022 16:52:50 +0200 Subject: [PATCH] #8541 Added file customer_key --- pandora_console/godmode/setup/license.php | 7 +++++-- pandora_console/include/functions_api.php | 25 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/setup/license.php b/pandora_console/godmode/setup/license.php index 2bfe905440..cd7a8db4cd 100644 --- a/pandora_console/godmode/setup/license.php +++ b/pandora_console/godmode/setup/license.php @@ -74,8 +74,11 @@ if ($update_settings) { ); } - // Update the license file. - file_put_contents($config["remote_config"] . '/' . LICENSE_FILE, $_POST['keys']['customer_key']); + // Update the license file. + $result = file_put_contents($config['remote_config'].'/'.LICENSE_FILE, $_POST['keys']['customer_key']); + if ($result === false) { + ui_print_error_message(__('Failed to Update license file')); + } ui_print_success_message(__('License updated')); } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 92263e0764..21cbf6fcd2 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -14904,6 +14904,31 @@ function api_set_metaconsole_synch($keys) } +function api_set_metaconsole_license_file($key) +{ + global $config; + + if (defined('METACONSOLE')) { + return; + } + + if (empty($key) === true) { + returnError('Key cannot be empty.'); + return; + } + + // Update the license file. + $result = file_put_contents($config['remote_config'].'/'.LICENSE_FILE, $key); + if ($result === false) { + returnError('update-license', 'Failed to Update license file.'); + } else { + returnData('string', ['type' => 'string', 'data' => true]); + } + + return; +} + + function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) { global $config;