Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FXIOS-5343 [v109] Removes migrate bookmarks to places db #12580

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Providers/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,6 @@ open class BrowserProfile: Profile {
log.debug("Reopening profile.")
isShutdown = false

if !places.isOpen && !RustFirefoxAccounts.shared.hasAccount() {
places.migrateBookmarksIfNeeded(fromBrowserDB: database)
}

database.reopenIfClosed()
_ = logins.reopenIfClosed()
_ = places.reopenIfClosed()
Expand Down
33 changes: 0 additions & 33 deletions Storage/Rust/RustPlaces.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,6 @@ public class RustPlaces: BookmarksHandler, HistoryMetadataObserver {
return deferred
}

public func migrateBookmarksIfNeeded(fromBrowserDB browserDB: BrowserDB) {
// Since we use the existence of places.db as an indication that we've
// already migrated bookmarks, assert that places.db is not open here.
assert(!isOpen, "Shouldn't attempt to migrate bookmarks after opening Rust places.db")

// We only need to migrate bookmarks here if the old browser.db file
// already exists AND the new Rust places.db file does NOT exist yet.
// This is to ensure that we only ever run this migration ONCE. In
// addition, it is the caller's (Profile.swift) responsibility to NOT
// use this migration API for users signed into a Firefox Account.
// Those users will automatically get all their bookmarks on next Sync.
guard FileManager.default.fileExists(atPath: browserDB.databasePath),
!FileManager.default.fileExists(atPath: databasePath) else {
return
}

// Ensure that the old BrowserDB schema is up-to-date before migrating.
_ = browserDB.touch().value

// Open the Rust places.db now for the first time.
_ = reopenIfClosed()

do {
try api?.migrateBookmarksFromBrowserDb(path: browserDB.databasePath)
} catch let err as NSError {
SentryIntegration.shared.sendWithStacktrace(
message: "Error encountered while migrating bookmarks from BrowserDB",
tag: SentryTag.rustPlaces,
severity: .error,
description: err.localizedDescription)
}
}

public func getBookmarksTree(rootGUID: GUID, recursive: Bool) -> Deferred<Maybe<BookmarkNodeData?>> {
return withReader { connection in
return try connection.getBookmarksTree(rootGUID: rootGUID, recursive: recursive)
Expand Down