mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Readd removing of unmodified cache files (#2947)
Co-authored-by: Mm2PL <mm2pl+gh@kotmisia.pl> Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
8385d06369
commit
6830e8b01b
2 changed files with 6 additions and 5 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
- Minor: Channel name in `<channel> has gone offline. Exiting host mode.` messages is now clickable. (#2922)
|
- Minor: Channel name in `<channel> has gone offline. Exiting host mode.` messages is now clickable. (#2922)
|
||||||
- Minor: Added `/openurl` command. Usage: `/openurl <URL>`. Opens the provided URL in the browser. (#2461, #2926)
|
- Minor: Added `/openurl` command. Usage: `/openurl <URL>`. Opens the provided URL in the browser. (#2461, #2926)
|
||||||
|
- Bugfix: Now deleting cache files that weren't modified in the past 14 days. (#2947)
|
||||||
- Bugfix: Fixed large timeout durations in moderation buttons overlapping with usernames or other buttons. (#2865, #2921)
|
- Bugfix: Fixed large timeout durations in moderation buttons overlapping with usernames or other buttons. (#2865, #2921)
|
||||||
- Bugfix: Fix bad behavior of the HTML color picker edit when user input is being entered. (#2942)
|
- Bugfix: Fix bad behavior of the HTML color picker edit when user input is being entered. (#2942)
|
||||||
|
|
||||||
|
|
|
@ -145,17 +145,17 @@ namespace {
|
||||||
// improved in the future.
|
// improved in the future.
|
||||||
void clearCache(const QDir &dir)
|
void clearCache(const QDir &dir)
|
||||||
{
|
{
|
||||||
qCDebug(chatterinoCache) << "[Cache] cleared cache";
|
int deletedCount = 0;
|
||||||
|
|
||||||
QStringList toBeRemoved;
|
|
||||||
|
|
||||||
for (auto &&info : dir.entryInfoList(QDir::Files))
|
for (auto &&info : dir.entryInfoList(QDir::Files))
|
||||||
{
|
{
|
||||||
if (info.lastModified().addDays(14) < QDateTime::currentDateTime())
|
if (info.lastModified().addDays(14) < QDateTime::currentDateTime())
|
||||||
{
|
{
|
||||||
toBeRemoved << info.absoluteFilePath();
|
bool res = QFile(info.absoluteFilePath()).remove();
|
||||||
|
if (res)
|
||||||
|
++deletedCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qCDebug(chatterinoCache) << "Deleted" << deletedCount << "files";
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue