[web-php] master: Remove load checker (#404)
| From: | George Peter Banyard via GitHub | Date: | Wed, 19 May 2021 19:03:43 +0000 |
| Subject: | [web-php] master: Remove load checker (#404) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-29310@lists.php.net to get a copy of this message | ||
Author: George Peter Banyard (Girgias)
Committer: GitHub (web-flow)
Pusher: sgolemon
Date: 2021-05-19T14:03:57-05:00
Commit: https://github.com/php/web-php/commit/c2db08cdbe52484bfe197c04975eb8125d857406
Raw diff: https://github.com/php/web-php/commit/c2db08cdbe52484bfe197c04975eb8125d857406.diff
Remove load checker (#404)
We do not use mirrors anymore, thus this is irrelevant.
Changed paths:
D include/loadavg.inc
M error.php
M manual-lookup.php
Diff:
diff --git a/error.php b/error.php
index 6e89e31d0..c5121e86c 100644
--- a/error.php
+++ b/error.php
@@ -12,7 +12,6 @@
// Ensure that our environment is set up
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/languages.inc';
-include_once __DIR__ . '/include/loadavg.inc';
include_once __DIR__ . '/include/errors.inc';
// Get URI for this request, strip leading slash
diff --git a/include/loadavg.inc b/include/loadavg.inc
deleted file mode 100644
index 85d63a530..000000000
--- a/include/loadavg.inc
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php # vim:ft=php
-
-/*
- Offload to the visitor's nearest mirror if the load is too high.
- We use the sys_getloadavg() function that requires PHP 5.1.3+
-*/
-
-// Check load on mirror
-function load_check()
-{
- global $COUNTRY, $MIRRORS;
-
- // We cannot check the load here
- if (!function_exists("sys_getloadavg") || !is_primary_site()) {
- return;
- }
-
- // Get load and print it out in header
- $load = sys_getloadavg();
- header("X-PHP-Load: " . implode(", ", $load));
- $load = $load[0];
-
- // Load is very high
- if ($load > 80) { load_toobusy(); }
-}
-
-// Send reply to the client that we are too busy now
-function load_toobusy()
-{
- header("HTTP/1.1 503 Too busy, try again later");
- echo "Server too busy, please try again later, or <a
href=\"/mirrors.php\">use a mirror</a>";
- exit;
-}
-
-load_check();
diff --git a/manual-lookup.php b/manual-lookup.php
index b515926ef..f20d4a44e 100644
--- a/manual-lookup.php
+++ b/manual-lookup.php
@@ -1,7 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'manual-lookup.php';
include __DIR__ . '/include/prepend.inc';
-include __DIR__ . '/include/loadavg.inc';
include __DIR__ . '/include/manual-lookup.inc';
// BC code, so pattern and function can both be used as