From 41e72d1c86820796b2d0071905c98696977b591d Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 1 Mar 2026 01:15:48 +0000 Subject: [PATCH] LPA-Health-V1.4-28-Feb-2026 --- admin_dashboard.php | 147 +++++++++++- api/allocate_credits.php | 39 +++ api/download_backup.php | 46 ++++ api/run_migrations.php | 17 +- api/save_lpa.php | 14 ++ apply.php | 15 +- backups/backup_2026-03-01_00-59-10.sql | 280 ++++++++++++++++++++++ backups/backup_2026-03-01_01-03-59.sql | 280 ++++++++++++++++++++++ dashboard.php | 25 +- db/backup_helper.php | 82 +++++++ db/migrations/07_add_credits_to_users.sql | 2 + 11 files changed, 930 insertions(+), 17 deletions(-) create mode 100644 api/allocate_credits.php create mode 100644 api/download_backup.php create mode 100644 backups/backup_2026-03-01_00-59-10.sql create mode 100644 backups/backup_2026-03-01_01-03-59.sql create mode 100644 db/backup_helper.php create mode 100644 db/migrations/07_add_credits_to_users.sql 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.
+
+
+
+
+ + + +