From 10e03b9bac083b8844285ab137f114979874e6e5 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 26 Sep 2014 12:30:55 +0200 Subject: [PATCH] Fix length of date fields in database. The last digit of the time zone was missing because the database date fields were only 32 instead of 33 characters. Tomdroid sync failed because of this. Tomdroid sync works now! --- appinfo/database.xml | 6 +++--- appinfo/info.xml | 2 +- appinfo/version | 2 +- lib/notestorage.php | 16 +++++++++++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/appinfo/database.xml b/appinfo/database.xml index 5bf6172..176f89f 100755 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -90,19 +90,19 @@ note_create_date text true - 32 + 33 note_last_change_date text true - 32 + 33 note_last_metadata_change_date text true - 32 + 33 diff --git a/appinfo/info.xml b/appinfo/info.xml index 1008496..2074d61 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -3,7 +3,7 @@ grauphel Grauphel: Tomboy note server Tomboy REST API server to sync notes between devices - 0.1.1 + 0.2.0 AGPL3 or later Christian Weiske 7 diff --git a/appinfo/version b/appinfo/version index 17e51c3..0ea3a94 100755 --- a/appinfo/version +++ b/appinfo/version @@ -1 +1 @@ -0.1.1 +0.2.0 diff --git a/lib/notestorage.php b/lib/notestorage.php index bca7dfd..d802669 100644 --- a/lib/notestorage.php +++ b/lib/notestorage.php @@ -363,14 +363,24 @@ class NoteStorage return $notes; } + protected function fixDate($date) + { + if (strlen($date) == 32) { + //Bug in grauphel 0.1.1; date fields in DB had only 32 instead of 33 + // characters. The last digit of the time zone was missing + $date .= '0'; + } + return $date; + } + protected function noteFromRow($row) { return (object) array( 'guid' => $row['note_guid'], - 'create-date' => $row['note_create_date'], - 'last-change-date' => $row['note_last_change_date'], - 'last-metadata-change-date' => $row['note_last_metadata_change_date'], + 'create-date' => $this->fixDate($row['note_create_date']), + 'last-change-date' => $this->fixDate($row['note_last_change_date']), + 'last-metadata-change-date' => $this->fixDate($row['note_last_metadata_change_date']), 'title' => $row['note_title'], 'note-content' => $row['note_content'], -- 2.30.2