Fix length of date fields in database.
authorChristian Weiske <cweiske@cweiske.de>
Fri, 26 Sep 2014 10:30:55 +0000 (12:30 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 26 Sep 2014 10:30:55 +0000 (12:30 +0200)
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
appinfo/info.xml
appinfo/version
lib/notestorage.php

index 5bf61726a5b483c1ea14b6f9a950a67f5d672822..176f89f951bed3922545a410aae97c381f416192 100755 (executable)
                                <name>note_create_date</name>
                                <type>text</type>
                                <notnull>true</notnull>
-                               <length>32</length>
+                               <length>33</length>
                        </field>
                        <field>
                                <name>note_last_change_date</name>
                                <type>text</type>
                                <notnull>true</notnull>
-                               <length>32</length>
+                               <length>33</length>
                        </field>
                        <field>
                                <name>note_last_metadata_change_date</name>
                                <type>text</type>
                                <notnull>true</notnull>
-                               <length>32</length>
+                               <length>33</length>
                        </field>
 
                        <field>
index 1008496ca2e303859a4e566dde396fd42dbb4893..2074d614f2387dc807fd73197d6cdd821c708f75 100755 (executable)
@@ -3,7 +3,7 @@
        <id>grauphel</id>
        <name>Grauphel: Tomboy note server</name>
        <description>Tomboy REST API server to sync notes between devices</description>
-       <version>0.1.1</version>
+       <version>0.2.0</version>
        <licence>AGPL3 or later</licence>
        <author>Christian Weiske</author>
        <requiremin>7</requiremin>
index 17e51c385ea382d4f2ef124b7032c1604845622d..0ea3a944b399d25f7e1b8fe684d754eb8da9fe7f 100755 (executable)
@@ -1 +1 @@
-0.1.1
+0.2.0
index bca7dfd5d1cea3cc4d63da932c945ad1257701f0..d80266915da4efdfda5dbd7a33c11e7ea3a08f58 100644 (file)
@@ -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'],