]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
make sure conv_as->items is an array or don't proceed
[friendica.git] / include / network.php
index 10590f8bf4fcef8d2ea4a4b71310a3553dfba7b7..941ef5e1b9db7482555ae4c07a532c5dd0e1c900 100644 (file)
@@ -17,8 +17,10 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
 
        @curl_setopt($ch, CURLOPT_HEADER, true);
 
-       @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
-       @curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
+
+//  These settings aren't needed. We're following the location already. 
+//     @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+//     @curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
 
        if (!is_null($accept_content)){
                curl_setopt($ch,CURLOPT_HTTPHEADER, array (
@@ -104,9 +106,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
        $a->set_curl_headers($header);
        @curl_close($ch);
 
-       $stamp2 = microtime(true);
-       $duration = (float)($stamp2-$stamp1);
-       $a->performance["network"] += (float)$duration;
+       $a->save_timestamp($stamp1, "network");
 
        return($body);
 }}
@@ -201,9 +201,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
 
        curl_close($ch);
 
-       $stamp2 = microtime(true);
-       $duration = (float)($stamp2-$stamp1);
-       $a->performance["network"] += (float)$duration;
+       $a->save_timestamp($stamp1, "network");
 
        return($body);
 }}
@@ -851,8 +849,11 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
                        $i = fetch_url($scaled);
 
                        $cachefile = get_cachefile(hash("md5", $scaled));
-                       if ($cachefile != '')
+                       if ($cachefile != '') {
+                               $stamp1 = microtime(true);
                                file_put_contents($cachefile, $i);
+                               $a->save_timestamp($stamp1, "file");
+                       }
 
                        // guess mimetype from headers or filename
                        $type = guess_image_type($mtch[1],true);