aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/admin
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2021-01-20 14:45:59 +0100
committerArthurHoaro <arthur@hoa.ro>2021-01-20 15:01:29 +0100
commit9b8c0a4560fa1d87cab1529099b1b4677e92e265 (patch)
tree330a9b1a42ff7b7f24a76612b57fae63417ef483 /application/front/controller/admin
parent055d97f9a9e67d8ee8ae81bbf59a4b846a145d9f (diff)
downloadShaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.tar.gz
Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.tar.zst
Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.zip
Handle pagination through BookmarkService
Handle all search results through SearchResult object. This is a required step toward implementing a BookmarkService based on SQL database. Related to #953
Diffstat (limited to 'application/front/controller/admin')
-rw-r--r--application/front/controller/admin/ManageTagController.php11
-rw-r--r--application/front/controller/admin/ThumbnailsController.php2
2 files changed, 8 insertions, 5 deletions
diff --git a/application/front/controller/admin/ManageTagController.php b/application/front/controller/admin/ManageTagController.php
index 8675a0c5..1333cce7 100644
--- a/application/front/controller/admin/ManageTagController.php
+++ b/application/front/controller/admin/ManageTagController.php
@@ -57,9 +57,12 @@ class ManageTagController extends ShaarliAdminController
57 } 57 }
58 58
59 // TODO: move this to bookmark service 59 // TODO: move this to bookmark service
60 $count = 0; 60 $searchResult = $this->container->bookmarkService->search(
61 $bookmarks = $this->container->bookmarkService->search(['searchtags' => $fromTag], BookmarkFilter::$ALL, true); 61 ['searchtags' => $fromTag],
62 foreach ($bookmarks as $bookmark) { 62 BookmarkFilter::$ALL,
63 true
64 );
65 foreach ($searchResult->getBookmarks() as $bookmark) {
63 if (false === $isDelete) { 66 if (false === $isDelete) {
64 $bookmark->renameTag($fromTag, $toTag); 67 $bookmark->renameTag($fromTag, $toTag);
65 } else { 68 } else {
@@ -68,11 +71,11 @@ class ManageTagController extends ShaarliAdminController
68 71
69 $this->container->bookmarkService->set($bookmark, false); 72 $this->container->bookmarkService->set($bookmark, false);
70 $this->container->history->updateLink($bookmark); 73 $this->container->history->updateLink($bookmark);
71 $count++;
72 } 74 }
73 75
74 $this->container->bookmarkService->save(); 76 $this->container->bookmarkService->save();
75 77
78 $count = $searchResult->getResultCount();
76 if (true === $isDelete) { 79 if (true === $isDelete) {
77 $alert = sprintf( 80 $alert = sprintf(
78 t('The tag was removed from %d bookmark.', 'The tag was removed from %d bookmarks.', $count), 81 t('The tag was removed from %d bookmark.', 'The tag was removed from %d bookmarks.', $count),
diff --git a/application/front/controller/admin/ThumbnailsController.php b/application/front/controller/admin/ThumbnailsController.php
index 94d97d4b..5dfea096 100644
--- a/application/front/controller/admin/ThumbnailsController.php
+++ b/application/front/controller/admin/ThumbnailsController.php
@@ -22,7 +22,7 @@ class ThumbnailsController extends ShaarliAdminController
22 public function index(Request $request, Response $response): Response 22 public function index(Request $request, Response $response): Response
23 { 23 {
24 $ids = []; 24 $ids = [];
25 foreach ($this->container->bookmarkService->search() as $bookmark) { 25 foreach ($this->container->bookmarkService->search()->getBookmarks() as $bookmark) {
26 // A note or not HTTP(S) 26 // A note or not HTTP(S)
27 if ($bookmark->isNote() || !startsWith(strtolower($bookmark->getUrl()), 'http')) { 27 if ($bookmark->isNote() || !startsWith(strtolower($bookmark->getUrl()), 'http')) {
28 continue; 28 continue;