mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
Remove load checker (#404)
We do not use mirrors anymore, thus this is irrelevant.
This commit is contained in:
committed by
GitHub
parent
b655da2d52
commit
c2db08cdbe
@@ -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
|
||||
|
||||
@@ -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();
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user