<?php
 require_once SRC_PATH . '/classes/Database.php'; class FileSystemController { private $db; public function __construct() { $this->db = Database::getInstance(); } public function getPlayerFiles() { $files = $this->db->query( "SELECT * FROM player_files ORDER BY copied_at DESC" )->fetchAll(PDO::FETCH_ASSOC); return $files; } public function getFileContent($fileId) { $file = $this->db->query( "SELECT * FROM player_files WHERE id = ?", [$fileId] )->fetch(PDO::FETCH_ASSOC); return $file; } public function deleteFile($fileId) { $result = $this->db->query( "DELETE FROM player_files WHERE id = ?", [$fileId] ); return true; } public function getFileCount() { $result = $this->db->query( "SELECT COUNT(*) as count FROM player_files" )->fetch(PDO::FETCH_ASSOC); return $result['count']; } public function getTotalSize() { $result = $this->db->query( "SELECT SUM(size) as total FROM player_files" )->fetch(PDO::FETCH_ASSOC); $bytes = $result['total'] ?? 0; return round($bytes / 1024 / 1024, 2); } } 