diff --git a/admin_dashboard.php b/admin_dashboard.php index 862c0b0..8cd8b74 100644 --- a/admin_dashboard.php +++ b/admin_dashboard.php @@ -1,5 +1,6 @@ query("SELECT * FROM migration_history ORDER BY executed_at DESC")->fetchAll(); } catch (PDOException $e) { - // migration_history might not exist yet if installer hasn't run or table not created $migration_history = []; } + + // Get backups from filesystem + $backups_dir = __DIR__ . '/backups'; + if (is_dir($backups_dir)) { + $backup_files = glob($backups_dir . '/backup_*.sql'); + foreach ($backup_files as $file) { + $backups[] = [ + 'filename' => basename($file), + 'size' => round(filesize($file) / 1024, 2) . ' KB', + 'created_at' => filemtime($file) + ]; + } + // Sort by created_at descending + usort($backups, function($a, $b) { + return $b['created_at'] - $a['created_at']; + }); + } } catch (PDOException $e) { error_log($e->getMessage()); } @@ -132,8 +150,9 @@ try { Name Email Role + Credits Verified - Joined + Actions @@ -146,6 +165,9 @@ try { + + + @@ -155,7 +177,9 @@ try { No - + + + @@ -217,8 +241,8 @@ try { -
-
+
+
Migration History
@@ -246,11 +270,117 @@ try {
+ +
+
+
+
Backups
+ Last 5 kept +
+
+ + + + + + + + + + 0): ?> + + + + + + + + + + + +
File NameSizeActions
+
+
+
+ + + Download + +
No backups found. Backups are created automatically before migrations.
+
+
+
+
+ + + +