-
Notifications
You must be signed in to change notification settings - Fork 537
/
mirror-info.php
47 lines (39 loc) · 1.77 KB
/
mirror-info.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
// Define $MYSITE and $LAST_UPDATED variables
include_once __DIR__ . '/include/prepend.inc';
// Define release_get_latest() function.
include_once __DIR__ . '/include/version.inc';
// Text/plain content type for better readability in browsers
header("Content-type: text/plain; charset=utf-8");
// Provide information on local stats setup
$mirror_stats = (int) (isset($_SERVER['MIRROR_STATS']) && $_SERVER['MIRROR_STATS'] == '1');
// SHA256 check last release file (identifies rsync setup problems)
[, $latest] = release_get_latest();
$dist = $latest['source'][0];
$filename = __DIR__ . "/distributions/{$dist['filename']}";
if (!file_exists($filename)) {
$hash_ok = 0;
} elseif (isset($dist['sha256']) &&
function_exists('hash_file') &&
in_array('sha256', hash_algos(), true)) {
$hash_ok = (int)(hash_file('sha256', $filename) === $dist['sha256']);
} else {
$hash_ok = 0;
}
// Does this mirror have sqlite?
// Gets all available sqlite versions for possible future sqlite wrapper
$sqlite = get_available_sqlites();
$exts = implode(',', get_loaded_extensions());
echo implode('|', [
$MYSITE, // 0 : CNAME for mirror as accessed (CC, CC1, etc.)
PHP_VERSION, // 1 : PHP version overview
$LAST_UPDATED, // 2 : Update problems
$sqlite, // 3 : SQLite support?
$mirror_stats, // 4 : Optional local stats support
default_language(), // 5 : Mirror language
'manual-noalias', // 6 : /manual alias check is done elsewhere now
$hash_ok, // 7 : Rsync setup problems
$exts, // 8 : List of php extensions separated by comma
gethostname(), // 9 : The configured hostname of the local system
$_SERVER['SERVER_ADDR'], // 10: The IP address under which we're running
]);