From 8894bd9cc0545dec2e96d7d4680a38340c63e43c Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Tue, 13 Sep 2022 23:40:03 +0200 Subject: [PATCH] Add helper functions for json files --- shared/main.php | 2 +- shared/utils.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/shared/main.php b/shared/main.php index 0ea4ef2..ecebfe2 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.37.0'; + return '1.38.0-dev'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/utils.php b/shared/utils.php index 6a78915..8c9c1cb 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -166,3 +166,16 @@ function uupApiFixDownloadLink($link) { $link ); } + +function uupApiReadJson($path) { + $data = @file_get_contents($path); + + if(empty($data)) + return false; + + return json_decode($data, true); +} + +function uupApiWriteJson($path, $data) { + return file_put_contents($path, json_encode($data)."\n"); +}