Expand admin system information and license notices

This commit is contained in:
2026-11-25 21:39:13 +08:00
parent 2e1e43a3ce
commit acf59c9dfc
18 changed files with 1014 additions and 21 deletions
+12
View File
@@ -88,6 +88,18 @@ final class Media
return rtrim(Environment::path('LAYSITE_MEDIA_DIR', 'storage/media'), '/');
}
public static function usage(): array
{
$bytes = Database::connect()->query('SELECT COALESCE(SUM(size), 0) FROM media')->fetchColumn();
$directory = self::directory();
$free = is_dir($directory) ? @disk_free_space($directory) : false;
return [
'size' => SystemInfo::bytes((int) $bytes),
'free' => $free === false ? null : SystemInfo::bytes($free),
];
}
public static function validateBackup(string $path, string $name, string $mime, int $size): void
{
if ((new \finfo(FILEINFO_MIME_TYPE))->file($path) !== $mime