From a2b8ec195faf29b76983d6df41327e8923c4c509 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 19 Apr 2023 14:46:25 +0200 Subject: [PATCH] Fix userDefaults.json creation --- php/classes/AmdaAction.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index b6fd25d..0119ba2 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -1762,17 +1762,17 @@ class AmdaAction $childrenToReturn = array(); $children = []; if (!file_exists(DATAPATH.'defaultValues.json')) - return array('success' => false , 'defaultValues' => array(), 'message'=>'efaultvalues file not found.'); + return array('success' => false , 'defaultValues' => array(), 'message'=>'Defaultvalues file not found.'); $json_o = json_decode(file_get_contents(DATAPATH.'defaultValues.json'), true); if (empty($json_o)) return array('success' => false , 'defaultValues' => array(), 'message'=>'Error : defaultValues file empty.'); - if (!file_exists(USERDIR.'userDefaults.json')) - return array('success' => true , 'defaultValues' => $json_o, 'message'=>'No modification on defaultvalues.'); - - $json_user = json_decode(file_get_contents(USERDIR.'userDefaults.json'), true); - if (empty($json_user)) - return array('success' => true , 'defaultValues' => $json_o, 'message'=>'No modification on defaultvalues.'); + $json_user = array(); + if (file_exists(USERDIR.'userDefaults.json')) + $json_user = json_decode(file_get_contents(USERDIR.'userDefaults.json'), true); + if (empty($json_user)) { + $json_user = array(); + } foreach($json_user as $key => $value){ $keys = explode(".", $key); -- libgit2 0.21.2