Edit: /data/vendor-scripts/php/stats.php (3371B)
date('Y-m-d\TH:i:sO'),
'serverName' => php_uname('n'),
);
if (defined('PHP_MAJOR_VERSION') && defined('PHP_MINOR_VERSION')) {
$stats['phpVersion'] = sprintf('%d.%d', PHP_MAJOR_VERSION, PHP_MINOR_VERSION);
} else {
$version = explode('.', phpversion());
$stats['phpVersion'] = sprintf('%d.%d', $version[0], $version[1]);
}
if (isset($_SERVER['HTTP_HOST'])) {
$stats['uri'] = $_SERVER['HTTP_HOST'];
}
if (isset($_SERVER['USER'])) {
$stats['account'] = $_SERVER['USER'];
}
if (function_exists('realpath_cache_size')) {
$stats['realpath_cache_size'] = array(
'configured' => ini_value_to_bytes(ini_get('realpath_cache_size')),
'real' => realpath_cache_size(),
);
}
if (! $limited && function_exists('realpath_cache_get')) {
$stats['realpath'] = realpath_cache_get();
}
if (function_exists('opcache_get_status')) {
$stats['opcache'] = opcache_get_status(! $limited);
}
if (function_exists('apc_cache_info')) {
$stats['apc'] = array();
foreach (array('system', 'user', 'filehits') as $type) {
$info = apc_cache_info($type, $limited);
if ($info) {
$stats['apc'][$type] = $info;
}
}
}
if (function_exists('apc_sma_info')) {
if (! array_key_exists('apc', $stats)) {
$stats['apc'] = array();
}
$stats['apc']['sma'] = apc_sma_info($limited);
}
if (function_exists('apcu_cache_info')) {
$info = apcu_cache_info($limited);
if ($info) {
// It looks like the $limited flag is not working
if ($limited) {
if (isset($info['cache_list'])) {
unset($info['cache_list']);
}
if (isset($info['slot_distribution'])) {
unset($info['slot_distribution']);
}
if (isset($info['deleted_list'])) {
unset($info['deleted_list']);
}
}
$stats['apcu'] = $info;
}
}
$options = 0;
if (defined('JSON_PRETTY_PRINT')) {
$options |= JSON_PRETTY_PRINT;
}
if (defined('JSON_UNESCAPED_SLASHES')) {
$options |= JSON_UNESCAPED_SLASHES;
}
if (function_exists('json_encode')) {
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
echo json_encode($stats, $options);
} else {
echo json_encode($stats);
}
} else {
// Manually export the data
$json = array();
foreach ($stats as $k => $v) {
if (!is_string($v)) {
continue;
}
$json[] = sprintf('"%s": "%s"', $k, $v);
}
echo sprintf('{%s}', implode(",", $json));
}