- $this->conf->set('general.header_link', $link, true, true);
+ /**
+ * With the Slim routing system, note bookmarks URL formatted `?abcdef`
+ * should be replaced with `/shaare/abcdef`
+ */
+ public function updateMethodMigrateExistingNotesUrl(): bool
+ {
+ $updated = false;
+
+ foreach ($this->bookmarkService->search() as $bookmark) {
+ if ($bookmark->isNote()
+ && startsWith($bookmark->getUrl(), '?')
+ && 1 === preg_match('/^\?([a-zA-Z0-9-_@]{6})($|&|#)/', $bookmark->getUrl(), $match)
+ ) {
+ $updated = true;
+ $bookmark = $bookmark->setUrl('/shaare/' . $match[1]);
+
+ $this->bookmarkService->set($bookmark, false);
+ }
+ }
+
+ if ($updated) {
+ $this->bookmarkService->save();