diff options
author | Andrew Dolgov <[email protected]> | 2018-12-16 19:05:37 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-16 19:05:37 +0300 |
commit | 957c44d177e6577e2f3b98560c8f2b67883806d4 (patch) | |
tree | b0f4de5b06289d68c841f00e720ce7bef3165b0f /classes/rpc.php | |
parent | c3b8b6a2a19102f958a9e4c2c007d83abe52ef9b (diff) |
rework git update checking to be initiated by frontend, outside of runtime info output
Diffstat (limited to 'classes/rpc.php')
-rwxr-xr-x | classes/rpc.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/classes/rpc.php b/classes/rpc.php index 61212fe8b..eb6fd4895 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -324,7 +324,7 @@ class RPC extends Handler_Protected { if ($reply['error']['code'] == 0) { $reply['init-params'] = make_init_params(); - $reply['runtime-info'] = make_runtime_info(true); + $reply['runtime-info'] = make_runtime_info(); } print json_encode($reply); @@ -597,4 +597,27 @@ class RPC extends Handler_Protected { } } + + function checkforupdates() { + $rv = []; + + if (CHECK_FOR_UPDATES && defined("GIT_VERSION_TIMESTAMP")) { + $content = @fetch_file_contents(["url" => "https://tt-rss.org/version.json"]); + + if ($content) { + $content = json_decode($content, true); + + if ($content && isset($content["changeset"])) { + if ((int)GIT_VERSION_TIMESTAMP < (int)$content["changeset"]["timestamp"] && + GIT_VERSION_HEAD != $content["changeset"]["id"]) { + + $rv = $content["changeset"]; + } + } + } + } + + print json_encode($rv); + } + }
\ No newline at end of file |