1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 13:45:56 +00:00

rework git update checking to be initiated by frontend, outside of runtime info output

This commit is contained in:
Andrew Dolgov
2018-12-16 19:05:37 +03:00
parent c3b8b6a2a1
commit 957c44d177
4 changed files with 46 additions and 40 deletions

View File

@@ -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);
}
}