Merge lp:~osomon/webbrowser-app/cache-deleter-update into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1036
Merged at revision: 1044
Proposed branch: lp:~osomon/webbrowser-app/cache-deleter-update
Merge into: lp:webbrowser-app
Diff against target: 44 lines (+12/-6)
2 files modified
src/app/webbrowser/SettingsPage.qml (+1/-1)
src/app/webbrowser/cache-deleter.cpp (+11/-5)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/cache-deleter-update
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+260548@code.launchpad.net

Commit message

Actually clear the network cache by deleting the correct set of files in the correct directory.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/SettingsPage.qml'
2--- src/app/webbrowser/SettingsPage.qml 2015-05-22 19:20:27 +0000
3+++ src/app/webbrowser/SettingsPage.qml 2015-05-29 08:47:28 +0000
4@@ -256,7 +256,7 @@
5 text: i18n.tr("Clear Cache")
6 onClicked: {
7 enabled = false
8- CacheDeleter.clear(cacheLocation + "/Cache", function() { enabled = true })
9+ CacheDeleter.clear(cacheLocation + "/Cache2", function() { enabled = true })
10 }
11 }
12 }
13
14=== modified file 'src/app/webbrowser/cache-deleter.cpp'
15--- src/app/webbrowser/cache-deleter.cpp 2015-03-12 19:07:29 +0000
16+++ src/app/webbrowser/cache-deleter.cpp 2015-05-29 08:47:28 +0000
17@@ -60,16 +60,22 @@
18 */
19 void CacheDeleter::doClear(const QString& cachePath)
20 {
21- // This assumes the cache is using chromium’s blockfile backend
22- // TODO: if oxide switches to using the simple backend
23- // (https://launchpad.net/bugs/1430349), this will need updating
24- // to remove a different set of files.
25- QStringList nameFilters = QStringList() << "data_*" << "f_*";
26+ // This assumes the cache is using chromium’s simple cache backend.
27+ QStringList nameFilters = QStringList()
28+ << "0*" << "1*" << "2*" << "3*" << "4*" << "5*" << "6*" << "7*"
29+ << "8*" << "9*" << "a*" << "b*" << "c*" << "d*" << "e*" << "f*"
30+ << "index";
31 QDir::Filters filters = QDir::Files | QDir::NoDotAndDotDot;
32 QFileInfoList files = QDir(cachePath).entryInfoList(nameFilters, filters);
33 Q_FOREACH(const QFileInfo& file, files) {
34 QFile::remove(file.absoluteFilePath());
35 }
36+
37+ nameFilters = QStringList() << "the-real-index";
38+ files = QDir(cachePath + "/index-dir").entryInfoList(nameFilters, filters);
39+ Q_FOREACH(const QFileInfo& file, files) {
40+ QFile::remove(file.absoluteFilePath());
41+ }
42 }
43
44 void CacheDeleter::onCleared()

Subscribers

People subscribed via source and target branches

to status/vote changes: