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

New account not synced with remote carddav #308

Closed
kearva opened this issue Oct 27, 2020 · 3 comments
Closed

New account not synced with remote carddav #308

kearva opened this issue Oct 27, 2020 · 3 comments
Assignees
Labels
bug DB schema change Resolution to this issue involves change of the database schema
Milestone

Comments

@kearva
Copy link
Contributor

kearva commented Oct 27, 2020

RCMCardDAV Version: v4.0.0
RCM Version: Docker Image roundcube/roundcubemail:1.4.x-apache

In function checkResyncDue (in src/Addressbook.php), there is a check if it is a long time since last sync.

When a new addressbook is created in the database, last_updated is set to 0. This results in checkResyncDue always beeing larger than zero (in fact it will return current timestamp pluss the value set for refresh_time), which again results that the first sync isn't done before the user adds a contact to the address book.

I suggest to change line 2095 from:

$ts_lastupd = Database::sqlDateTimeToSeconds($this->config["last_updated"], $ts_now);

to:

$ts_lastupd = $this->config["last_updated"]?Database::sqlDateTimeToSeconds($this->config["last_updated"], $ts_now):0;

This way one can be sure that first access will result in a sync of the addressbook.

@mstilkerich
Copy link
Owner

Thanks for reporting this issue, I can see how this problem occurs with the default value we use in SQLite for the last_updated column.

@mstilkerich mstilkerich self-assigned this Oct 27, 2020
@mstilkerich mstilkerich added bug DB schema change Resolution to this issue involves change of the database schema labels Oct 27, 2020
@mstilkerich mstilkerich added this to the v4.0.1 milestone Oct 27, 2020
@mstilkerich
Copy link
Owner

This should be fixed with the commit listed above. I will do some testing and then merge this to master.

@kearva
Copy link
Contributor Author

kearva commented Oct 29, 2020

I have tested your solution and it seems to be working as expected. Thank you for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug DB schema change Resolution to this issue involves change of the database schema
Projects
None yet
Development

No branches or pull requests

2 participants