fix cleanup_feed_icons unlinking nonexistant files, limit it to actual feed icons

This commit is contained in:
Andrew Dolgov 2022-12-02 07:34:51 +03:00
parent 94c49399cc
commit 824addbc9d
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
1 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class RSSUtils {
if ($dh) {
while (($icon = readdir($dh)) !== false) {
if ($cache->get_mtime($icon) < time() - 86400 * Config::get(Config::CACHE_MAX_DAYS)) {
if (preg_match('/^[0-9]{1,}$/', $icon) && $cache->get_mtime($icon) < time() - 86400 * Config::get(Config::CACHE_MAX_DAYS)) {
$sth->execute([(int)$icon]);
@ -54,7 +54,7 @@ class RSSUtils {
$icon_path = $cache->get_full_path($icon);
Debug::log("Removing orphaned feed icon: $icon_path");
unlink($icon);
unlink($icon_path);
}
}
}