Skip to content

Commit

Permalink
fix: maintenance task, account for custom payment method icons
Browse files Browse the repository at this point in the history
  • Loading branch information
ellite committed Jul 9, 2024
1 parent 2855992 commit 28c8a96
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
13 changes: 12 additions & 1 deletion admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class="one-third" value="<?= $settings['smtp_port'] ?>" />
<?php
// find unused upload logos

// Get all logos in the database
// Get all logos in the subscriptions table
$query = 'SELECT logo FROM subscriptions';
$stmt = $db->prepare($query);
$result = $stmt->execute();
Expand All @@ -237,6 +237,17 @@ class="one-third" value="<?= $settings['smtp_port'] ?>" />
$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
Expand Down
13 changes: 13 additions & 0 deletions endpoints/admin/deleteunusedlogos.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2251,7 +2251,6 @@ button.dark-theme-button i {

.bold {
font-weight: 700;

}

/* Checkbox */
Expand Down

0 comments on commit 28c8a96

Please sign in to comment.