From 9bf7a3cbb8879f734a0db92c1cfc5b9d3f0a3164 Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Date: Sat, 17 Jan 2026 18:26:15 -0300 Subject: [PATCH] Revert "Key the CloudDB cache by hostname and add a button to clear the cache (#4794)" This reverts commit b25b3e3c6167506cfbb5efc3009d51531a6e342e. While this is useful for development and testing we don't need it for release versions and it invalidates existing caches causing additional traffic on CloudDB servers. --- src/Cloud/CloudDBChart.cpp | 37 ++------------------------------- src/Cloud/CloudDBChart.h | 3 --- src/Cloud/CloudDBUserMetric.cpp | 4 ++-- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/Cloud/CloudDBChart.cpp b/src/Cloud/CloudDBChart.cpp index 7c5d708d1..1e7761d0e 100644 --- a/src/Cloud/CloudDBChart.cpp +++ b/src/Cloud/CloudDBChart.cpp @@ -50,10 +50,10 @@ CloudDBChartClient::CloudDBChartClient() g_nam = new QNetworkAccessManager(this); QDir cacheDir(QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation).at(0)); cacheDir.cdUp(); - g_cacheDir = QString(cacheDir.absolutePath()+"/GoldenCheetahCloudDB/" + QString(QT_STRINGIFY(GC_CLOUD_DB_APP_NAME))); + g_cacheDir = QString(cacheDir.absolutePath()+"/GoldenCheetahCloudDB"); QDir newCacheDir(g_cacheDir); if (!newCacheDir.exists()) { - newCacheDir.mkpath(g_cacheDir); + cacheDir.mkdir("GoldenCheetahCloudDB"); } // general handling for sslErrors @@ -237,15 +237,6 @@ CloudDBChartClient::getAllChartHeader(QList* header) { return request_ok; } -bool -CloudDBChartClient::clearAllCache() { - QDir cacheDir(g_cacheDir); - if (cacheDir.exists()) { - return cacheDir.removeRecursively(); - } - return true; -} - // // Trap SSL errors @@ -458,24 +449,20 @@ CloudDBChartListDialog::CloudDBChartListDialog() : const_stepSize(5) showing = new QLabel; showingTextTemplate = tr("Showing %1 to %2 of %3 charts for %4 / Total uploaded %5"); resetToStart = new QPushButton(tr("First")); - clearCacheButton = new QPushButton(tr("Clear Cache")); nextSet = new QPushButton(tr("Next %1").arg(QString::number(const_stepSize))); prevSet = new QPushButton(tr("Prev %1").arg(QString::number(const_stepSize))); resetToStart->setEnabled(true); nextSet->setDefault(true); - clearCacheButton->setEnabled(true); nextSet->setEnabled(true); prevSet->setEnabled(true); connect(resetToStart, SIGNAL(clicked()), this, SLOT(resetToStartClicked())); connect(nextSet, SIGNAL(clicked()), this, SLOT(nextSetClicked())); connect(prevSet, SIGNAL(clicked()), this, SLOT(prevSetClicked())); - connect(clearCacheButton, &QPushButton::clicked, this, &CloudDBChartListDialog::clearCacheClicked); showingLayout = new QHBoxLayout; showingLayout->addWidget(showing); showingLayout->addStretch(); - showingLayout->addWidget(clearCacheButton); showingLayout->addWidget(resetToStart); showingLayout->addWidget(prevSet); showingLayout->addWidget(nextSet); @@ -672,7 +659,6 @@ CloudDBChartListDialog::updateCurrentPresets(int index, int count) { prevSet->setEnabled(false); closeUserGetButton->setEnabled(false); addAndCloseUserGetButton->setEnabled(false); - clearCacheButton->setEnabled(false); curationStateCombo->setEnabled(false); ownChartsOnly->setEnabled(false); textFilterApply->setEnabled(false); @@ -769,10 +755,8 @@ CloudDBChartListDialog::updateCurrentPresets(int index, int count) { resetToStart->setEnabled(true); nextSet->setEnabled(true); prevSet->setEnabled(true); - clearCacheButton->setEnabled(true); closeUserGetButton->setEnabled(true); addAndCloseUserGetButton->setEnabled(true); - clearCacheButton->setEnabled(true); curationStateCombo->setEnabled(true); ownChartsOnly->setEnabled(true); textFilterApply->setEnabled(true); @@ -793,23 +777,6 @@ CloudDBChartListDialog::updateCurrentPresets(int index, int count) { } -void -CloudDBChartListDialog::clearCacheClicked() { - // clear the physical cache - g_client->clearAllCache(); - - // force a refresh from Network - CloudDBHeader::setChartHeaderStale(true); - - // reset UI - g_currentIndex = 0; - if (CloudDBHeader::isStaleChartHeader()) { - if (!refreshStaleChartHeader()) return; - CloudDBHeader::setChartHeaderStale(false); - } - applyAllFilters(); -} - void CloudDBChartListDialog::setVisibleButtonsForRole() { if (g_role == CloudDBCommon::UserEdit) { diff --git a/src/Cloud/CloudDBChart.h b/src/Cloud/CloudDBChart.h index 4ed7e2745..9e073c431 100644 --- a/src/Cloud/CloudDBChart.h +++ b/src/Cloud/CloudDBChart.h @@ -63,7 +63,6 @@ public: bool curateChartByID(qint64 id, bool newStatus); void incrementDownloadCounterByID(qint64 id); bool getAllChartHeader(QList* header); - bool clearAllCache(); bool sslLibMissing() { return noSSLlib; } @@ -134,7 +133,6 @@ private slots: void resetToStartClicked(); void nextSetClicked(); void prevSetClicked(); - void clearCacheClicked(); void ownChartsToggled(bool); void toggleTextFilterApply(); void curationStateFilterChanged(int); @@ -174,7 +172,6 @@ private: QPushButton *resetToStart; QPushButton *nextSet; QPushButton *prevSet; - QPushButton *clearCacheButton; QCheckBox *ownChartsOnly; QComboBox *curationStateCombo; QComboBox *langCombo; diff --git a/src/Cloud/CloudDBUserMetric.cpp b/src/Cloud/CloudDBUserMetric.cpp index bc5e2bba8..7ecc19c54 100644 --- a/src/Cloud/CloudDBUserMetric.cpp +++ b/src/Cloud/CloudDBUserMetric.cpp @@ -43,10 +43,10 @@ CloudDBUserMetricClient::CloudDBUserMetricClient() g_nam = new QNetworkAccessManager(this); QDir cacheDir(QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation).at(0)); cacheDir.cdUp(); - g_cacheDir = QString(cacheDir.absolutePath()+"/GoldenCheetahCloudDB/" + QString(QT_STRINGIFY(GC_CLOUD_DB_APP_NAME))); + g_cacheDir = QString(cacheDir.absolutePath()+"/GoldenCheetahCloudDB"); QDir newCacheDir(g_cacheDir); if (!newCacheDir.exists()) { - newCacheDir.mkpath(g_cacheDir); + cacheDir.mkdir("GoldenCheetahCloudDB"); } // general handling for sslErrors