aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/bookmark
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-23 21:13:41 +0100
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commitb0428aa9b02b058b72c40b6e8dc2298d55bf692f (patch)
treec57176b24d76836a73608fb273b1094fcb8de785 /application/bookmark
parent485b168a9677d160b0c0426e4f282b9bd0c632c1 (diff)
downloadShaarli-b0428aa9b02b058b72c40b6e8dc2298d55bf692f.tar.gz
Shaarli-b0428aa9b02b058b72c40b6e8dc2298d55bf692f.tar.zst
Shaarli-b0428aa9b02b058b72c40b6e8dc2298d55bf692f.zip
Migrate cache purge function to a proper class
And update dependencies and tests. Note that SESSION['tags'] has been removed a log ago
Diffstat (limited to 'application/bookmark')
-rw-r--r--application/bookmark/BookmarkFileService.php7
-rw-r--r--application/bookmark/BookmarkIO.php2
2 files changed, 6 insertions, 3 deletions
diff --git a/application/bookmark/BookmarkFileService.php b/application/bookmark/BookmarkFileService.php
index 9c59e139..fef998fd 100644
--- a/application/bookmark/BookmarkFileService.php
+++ b/application/bookmark/BookmarkFileService.php
@@ -12,6 +12,7 @@ use Shaarli\Formatter\BookmarkMarkdownFormatter;
12use Shaarli\History; 12use Shaarli\History;
13use Shaarli\Legacy\LegacyLinkDB; 13use Shaarli\Legacy\LegacyLinkDB;
14use Shaarli\Legacy\LegacyUpdater; 14use Shaarli\Legacy\LegacyUpdater;
15use Shaarli\Render\PageCacheManager;
15use Shaarli\Updater\UpdaterUtils; 16use Shaarli\Updater\UpdaterUtils;
16 17
17/** 18/**
@@ -39,6 +40,9 @@ class BookmarkFileService implements BookmarkServiceInterface
39 /** @var History instance */ 40 /** @var History instance */
40 protected $history; 41 protected $history;
41 42
43 /** @var PageCacheManager instance */
44 protected $pageCacheManager;
45
42 /** @var bool true for logged in users. Default value to retrieve private bookmarks. */ 46 /** @var bool true for logged in users. Default value to retrieve private bookmarks. */
43 protected $isLoggedIn; 47 protected $isLoggedIn;
44 48
@@ -49,6 +53,7 @@ class BookmarkFileService implements BookmarkServiceInterface
49 { 53 {
50 $this->conf = $conf; 54 $this->conf = $conf;
51 $this->history = $history; 55 $this->history = $history;
56 $this->pageCacheManager = new PageCacheManager($this->conf->get('resource.page_cache'));
52 $this->bookmarksIO = new BookmarkIO($this->conf); 57 $this->bookmarksIO = new BookmarkIO($this->conf);
53 $this->isLoggedIn = $isLoggedIn; 58 $this->isLoggedIn = $isLoggedIn;
54 59
@@ -275,7 +280,7 @@ class BookmarkFileService implements BookmarkServiceInterface
275 } 280 }
276 $this->bookmarks->reorder(); 281 $this->bookmarks->reorder();
277 $this->bookmarksIO->write($this->bookmarks); 282 $this->bookmarksIO->write($this->bookmarks);
278 invalidateCaches($this->conf->get('resource.page_cache')); 283 $this->pageCacheManager->invalidateCaches();
279 } 284 }
280 285
281 /** 286 /**
diff --git a/application/bookmark/BookmarkIO.php b/application/bookmark/BookmarkIO.php
index ae9ffcb4..1026e2f9 100644
--- a/application/bookmark/BookmarkIO.php
+++ b/application/bookmark/BookmarkIO.php
@@ -102,7 +102,5 @@ class BookmarkIO
102 $this->datastore, 102 $this->datastore,
103 self::$phpPrefix.base64_encode(gzdeflate(serialize($links))).self::$phpSuffix 103 self::$phpPrefix.base64_encode(gzdeflate(serialize($links))).self::$phpSuffix
104 ); 104 );
105
106 invalidateCaches($this->conf->get('resource.page_cache'));
107 } 105 }
108} 106}