Author: Nikita Popov (nikic)
Date: 2021-04-11T18:21:13+02:00

Commit: 
https://github.com/php/web-people/commit/19ec5aa95f08b447b09a7d4fd383961952f98456
Raw diff: 
https://github.com/php/web-people/commit/19ec5aa95f08b447b09a7d4fd383961952f98456.diff

Remove unused $options parameter from cached()

It's always false. This is used for HTTP requests, so setting it
to true makes no sense.

Changed paths:
  M  include/karma.php
  M  include/misc.php


Diff:

diff --git a/include/karma.php b/include/karma.php
index c7f961b..6bcfcb8 100644
--- a/include/karma.php
+++ b/include/karma.php
@@ -18,11 +18,11 @@ function findKarma($username)
 function fetchKarma()
 {
     $ctx = stream_context_create(array("http" => array("ignore_errors" => 
true)));
-    $content = cached("https://svn.php.net/repository/SVNROOT/global_avail";, 
false, $ctx);
+    $content = cached("https://svn.php.net/repository/SVNROOT/global_avail";, 
$ctx);
     $phpKarma = parseKarma(explode("\n", $content));
 
     $ctx = stream_context_create(array("http" => array("ignore_errors" => 
true)));
-    $content = cached("https://svn.php.net/repository/SVNROOT/pear_avail";, 
false, $ctx);
+    $content = cached("https://svn.php.net/repository/SVNROOT/pear_avail";, 
$ctx);
     $pearKarma = parseKarma(explode("\n", $content));
 
     $allKarma = $phpKarma;
diff --git a/include/misc.php b/include/misc.php
index 3fda481..98bd791 100644
--- a/include/misc.php
+++ b/include/misc.php
@@ -23,7 +23,7 @@ function findAllUsers($page) {
         $token = trim(file_get_contents("token"));
     }
     $url = "https://main.php.net/fetch/allusers.php?token="; . 
rawurlencode($token);
-    $retval = cached($url, false, $ctx);
+    $retval = cached($url, $ctx);
     $json = json_decode($retval, true);
     if (!is_array($json)) {
         error("Something happened to main");
@@ -48,7 +48,7 @@ function findPHPUser($username)
         $token = trim(file_get_contents("token"));
     }
     $url = "https://main.php.net/fetch/allusers.php?token="; . 
rawurlencode($token);
-    $retval = cached($url, false, $ctx);
+    $retval = cached($url, $ctx);
     $json = json_decode($retval, true);
     if (!is_array($json)) {
         error("Something happend to main");
@@ -65,7 +65,7 @@ function findPHPUser($username)
     error("No such user");
 }
 
-function cached($url, $options = false, $ctx = null)
+function cached($url, $ctx = null)
 {
     $tmpdir = sys_get_temp_dir();
     $user = sha1($url);
@@ -74,7 +74,7 @@ function cached($url, $options = false, $ctx = null)
     if (file_exists($tmpfile) && filemtime($tmpfile) > strtotime("-1 day")) {
         return file_get_contents($tmpfile);
     }
-    $content = file_get_contents($url, $options, $ctx);
+    $content = file_get_contents($url, false, $ctx);
     if ($content) {
         file_put_contents($tmpfile, $content);
     }
@@ -90,7 +90,7 @@ function findPHPUserProfile($username)
     if (!$token) {
         $token = trim(file_get_contents("token"));
     }
-    $retval = cached("https://main.php.net/fetch/user-profile.php?username="; . 
$username . "&token=" . rawurlencode($token), false, $ctx);
+    $retval = cached("https://main.php.net/fetch/user-profile.php?username="; . 
$username . "&token=" . rawurlencode($token), $ctx);
     if (!$retval) {
         $error   = error_get_last();
         // Remove the function name, arguments and all that stuff... we

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to