]> git.wh0rd.org - tt-rss.git/commitdiff
set smallish timeout on update check, exclude update checking on initial load
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Wed, 30 Mar 2016 10:32:49 +0000 (13:32 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Wed, 30 Mar 2016 10:32:49 +0000 (13:32 +0300)
classes/rpc.php
include/functions2.php

index 235db59ef21bb076dce990871e6312ffdd2f2466..617c7a22b8e9db334a18292b6bc97ee199a7c501 100755 (executable)
@@ -346,7 +346,7 @@ class RPC extends Handler_Protected {
 
                if ($reply['error']['code'] == 0) {
                        $reply['init-params'] = make_init_params();
-                       $reply['runtime-info'] = make_runtime_info();
+                       $reply['runtime-info'] = make_runtime_info(true);
                }
 
                print json_encode($reply);
index f31a619420fc3f6f636caf1c8116d039b1759a89..1c2ffb9369329532ad8c0571fd98e039f9f6f5f4 100644 (file)
 
        function check_for_update() {
                if (defined("GIT_VERSION_TIMESTAMP")) {
-                       $content = @fetch_file_contents("http://tt-rss.org/version.json");
+                       $content = @fetch_file_contents(array("url" => "http://tt-rss.org/version.json", "timeout" => 5));
 
                        if ($content) {
                                $content = json_decode($content, true);
                return "";
        }
 
-       function make_runtime_info() {
+       function make_runtime_info($disable_update_check = false) {
                $data = array();
 
                $result = db_query("SELECT MAX(id) AS mid, COUNT(*) AS nf FROM
                $data['reload_on_ts_change'] = !defined('_NO_RELOAD_ON_TS_CHANGE');
 
 
-               if (CHECK_FOR_UPDATES && $_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) {
+               if (CHECK_FOR_UPDATES && !$disable_update_check && $_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) {
                        $update_result = @check_for_update();
 
                        $data["update_result"] = $update_result;