Fix/cleanup after addressbook deletion#56
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean up
sync_bookswhen address books are deletedSummary
sync_booksuser preference automatically on every delete path (web UI, API/RPC, and automatic vbook removal).sync_bookschanges, matching the existing behavior for manual preference edits.sync_booksentries on the next contact sync instead of failing withInvalid address book.Problem
Turba stores the list of address books to export via ActiveSync in the
sync_bookspreference. When a new book is created through ActiveSync,addAddressbook()appends its share ID to that list — but none of the delete paths removed the ID again.The preferences UI only displays books that still exist, so stale IDs can remain in the stored preference unnoticed. On the next contact sync,
_getSources()loaded the preference and threwInvalid address book: <id>. ActiveSync logged the error and returned an empty contact list (Status 1, noPOOMCONTACTSdata), which manifested as empty contacts in Outlook while mail and calendar continued to work.Solution
Turba_Api::removeSyncBook($id)— remove one share ID fromsync_books; if the preference changed, call the ActiveSync contact state reset.Turba_Api::resetActiveSyncContactsState($notify)— centralize the device state reset previously duplicated inconfig/prefs.phpon_change.removeSyncBook()from all delete paths:Turba_Api::deleteAddressbook()(RPC / ActiveSync connector)Turba_Form_DeleteAddressBook::execute()(web UI)Turba::getConfigFromShares()(automatic removal of orphaned virtual address books)Turba_Api::_getSources()— when loading fromsync_books, skip IDs that no longer exist in$cfgSources, persist the pruned list, and continue with valid books. Explicit caller-supplied source IDs still fail fast with an exception.Files changed
lib/Api.phpremoveSyncBook(),resetActiveSyncContactsState(); cleanup indeleteAddressbook(); self-healing in_getSources()lib/Form/DeleteAddressBook.phpremoveSyncBook()beforeremoveShare()lib/Turba.phpremoveSyncBook()when removing orphaned vbooksconfig/prefs.phpsync_bookson_changeto useresetActiveSyncContactsState(true)Test plan
sync_books(Turba preferences or DB).sync_booksand ActiveSync devices receive a resync notification.sync_books, delete one; confirm the remaining book still syncs contacts to Outlook/iOS.sync_books; trigger a contact sync; confirm the stale ID is pruned, sync succeeds, and noInvalid address bookerror appears in the ActiveSync log.sync_booksmanually in Turba preferences; confirm ActiveSync contact state is still reset and the success notification is shown (unchanged behavior, refactored implementation).contacts/deleteAddressbookRPC) if available; confirm the samesync_bookscleanup occurs.