From 28c8a96948765d84e1053666025b66254574f649 Mon Sep 17 00:00:00 2001 From: Miguel Ribeiro Date: Tue, 9 Jul 2024 10:36:33 +0200 Subject: [PATCH] fix: maintenance task, account for custom payment method icons --- admin.php | 13 ++++++++++++- endpoints/admin/deleteunusedlogos.php | 13 +++++++++++++ styles/styles.css | 1 - 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/admin.php b/admin.php index 5e4575471..3d94c9547 100644 --- a/admin.php +++ b/admin.php @@ -227,7 +227,7 @@ class="one-third" value="" /> prepare($query); $result = $stmt->execute(); @@ -237,6 +237,17 @@ class="one-third" value="" /> $logosOnDB[] = $row['logo']; } + // Get all logos in the payment_methods table + $query = 'SELECT icon FROM payment_methods'; + $stmt = $db->prepare($query); + $result = $stmt->execute(); + + while ($row = $result->fetchArray(SQLITE3_ASSOC)) { + if (!strstr($row['icon'], "images/uploads/icons/")) { + $logosOnDB[] = $row['icon']; + } + } + $logosOnDB = array_unique($logosOnDB); // Get all logos in the uploads folder diff --git a/endpoints/admin/deleteunusedlogos.php b/endpoints/admin/deleteunusedlogos.php index 44afad83a..2fba6eb53 100644 --- a/endpoints/admin/deleteunusedlogos.php +++ b/endpoints/admin/deleteunusedlogos.php @@ -37,6 +37,19 @@ } } + // Get all logos in the payment_methods table + $query = 'SELECT icon FROM payment_methods'; + $stmt = $db->prepare($query); + $result = $stmt->execute(); + + while ($row = $result->fetchArray(SQLITE3_ASSOC)) { + if (!strstr($row['icon'], "images/uploads/icons/")) { + $logosOnDB[] = $row['icon']; + } + } + + $logosOnDB = array_unique($logosOnDB); + // Find and delete unused logos $count = 0; foreach ($logosOnDisk as $disk) { diff --git a/styles/styles.css b/styles/styles.css index 3c0089768..4956b3c8e 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -2251,7 +2251,6 @@ button.dark-theme-button i { .bold { font-weight: 700; - } /* Checkbox */