forked from uup-dump/api
Add helper functions for json files
This commit is contained in:
parent
54b605c1d4
commit
8894bd9cc0
@ -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';
|
||||
|
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user