Show CodePress version and OS in admin site info

This commit is contained in:
2026-07-28 14:47:49 +02:00
parent 3bb16ff116
commit c8343a096e
2 changed files with 12 additions and 1 deletions
+9 -1
View File
@@ -178,6 +178,9 @@ function handleDashboard(AdminAuth $auth, array $config): void
$pluginsDir = $config['plugins_dir'];
$configJson = $config['config_json'];
$versionFile = __DIR__ . '/../version.php';
$versionInfo = file_exists($versionFile) ? include $versionFile : [];
$stats = [
'pages' => countFiles($contentDir, ['md', 'php', 'html']),
'directories' => countDirs($contentDir),
@@ -185,6 +188,8 @@ function handleDashboard(AdminAuth $auth, array $config): void
'config_exists' => file_exists($configJson),
'content_size' => formatSize(dirSize($contentDir)),
'php_version' => PHP_VERSION,
'cms_version' => $versionInfo['version'] ?? '-',
'os' => PHP_OS_FAMILY . ' (' . php_uname('r') . ')',
];
// Load site config
@@ -290,7 +295,10 @@ function adminLog(array $config, string $level, string $message): void
@mkdir($dir, 0755, true);
}
$timestamp = date('Y-m-d H:i:s');
$ip = $_SERVER['REMOTE_ADDR'] ?? 'cli';
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['REMOTE_ADDR'] ?? 'cli';
if (($commaPos = strpos($ip, ',')) !== false) {
$ip = trim(substr($ip, 0, $commaPos));
}
@file_put_contents($logFile, "[{$timestamp}] [{$level}] [{$ip}] {$message}\n", FILE_APPEND);
}