forked from laysense/laysite
Expand admin system information and license notices
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user